[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Divide tc-config.xml file  XML
Forum Index -> Terracotta for Spring
Author Message
navneet

journeyman

Joined: 03/12/2007 21:17:02
Messages: 13
Location: Delhi, India
Offline

Hi,

I have 2 JVM runing on different machines. Each use its tc-config.xml file although the content in them are same except the given tag.
<clients>
<logs>C:/tc_client</logs>
</clients>.

Is there any feature by which i can include partial tc-config.xml files to form a single tc-config.xml file.



Regards,
Navneet Singhal
kbhasin

consul

Joined: 12/04/2006 13:08:21
Messages: 340
Offline

Hello Navneet,

Terracotta allows you to use variables or wildcards to have indivdual logging behavior on each node.

There are a few variables that will be interpolated by the configuration subsystem:

Variable                Interpolated Value
%h                            The hostname
%i                             The ip address
%(system property)    The value of the given system property


These variables will be interpolated in the following places:

* the "name" and "host" attributes of the <server> element
* the password file location for JMX authentication
* client logs location
* server logs location
* server data location

The %(system.property) variable will be substituted by the value of the system property available to the java runtime environment. This can be very useful.

For example, you can use the %(system.property) in the following way:

<clients>
<logs>%(user.home)/some/directory</logs>
</clients>

which would mean that the logs would be written relative to the home directory of the user.

Similarly, %(com.mycompany.propname) will substitute in the value of Java system property 'com.mycompany.propname' and value of 'server-data-%h' would expand to 'server-data-artichoke' if running on host 'artichoke'.

Here is the link to the documentation:

http://www.terracotta.org/confluence/display/docs1/Configuration+Guide+and+Reference#ConfigurationGuideandReference-ConfigurationVariables

You will also find some more examples in this link:

http://www.terracotta.org/confluence/display/docs1/Configuration+Guide+and+Reference#ConfigurationGuideandReference-%2Ftc%3Atcconfig%2Fservers%2Fserver%2Fdata

This is a little off from what you are trying to do, but you can have multiple "configuration bundles" (introduced in version 2.3.x onwards) which can be "combined" to form a single Terracotta configuration. The goal of configuration bundles though is to modularize the "application" configuration and not the logging.

You can track the progress on configuration bundles here:

http://www.terracotta.org/confluence/display/wiki/Configuration+bundles

Regards,
Kunal Bhasin.

Regards,

Kunal Bhasin,
Terracotta, Inc.

Be a part of the Terracotta community: Join now!
navneet

journeyman

Joined: 03/12/2007 21:17:02
Messages: 13
Location: Delhi, India
Offline

Thanks for reply.
I am running two JVM on single machine.
using any of the variable %h , %i, %(system property) will cause both JVM's to share same log file.

m using terracotta 2.2.1


Regards,
Navneet Singhal
Gordon

journeyman

Joined: 12/13/2006 00:38:30
Messages: 44
Offline

Hi Navneet,

That would be the expected behavior. As of today, you would need to use two config files to specify unique log file locations for two clients running on the same machine. However, the second client will function if the first client has already locked the log file location for its use -- Terracotta will then just log to the console.

Regards,

Gordon
Sr. Systems Engineer
Terracotta, Inc.
kbhasin

consul

Joined: 12/04/2006 13:08:21
Messages: 340
Offline

Hello Navneet,

You could do something like this:

* Set the logs configuration for clients in tc-config:

<clients>
<logs>%(client.logs.directory)/logs/some/directory</logs>
</clients>


* Pass different values for the above system property when you start different VMs e.g. pass -Dclient.logs.directory=C:\client1 to VM1 and -Dclient.logs.directory=C:\client2 to VM2.

This way you will have different log locations for different VMs on the same machine.

Regards,
Kunal Bhasin.

Regards,

Kunal Bhasin,
Terracotta, Inc.

Be a part of the Terracotta community: Join now!
navneet

journeyman

Joined: 03/12/2007 21:17:02
Messages: 13
Location: Delhi, India
Offline

Thanks Kunal for great Idea.

Regards,
Navneet Singhal
kbhasin

consul

Joined: 12/04/2006 13:08:21
Messages: 340
Offline

You're most welcome. I am glad I could help.

Regards,
Kunal Bhasin.

Regards,

Kunal Bhasin,
Terracotta, Inc.

Be a part of the Terracotta community: Join now!
kbhasin

consul

Joined: 12/04/2006 13:08:21
Messages: 340
Offline

Here is another link on Terracotta Configuration Bundles for those who are interested: http://www.terracotta.org/confluence/display/docs1/Configuration+Guide+and+Reference#ConfigurationGuideandReference-configmodules

Regards,
Kunal Bhasin.

Regards,

Kunal Bhasin,
Terracotta, Inc.

Be a part of the Terracotta community: Join now!
kkessler

neo

Joined: 05/23/2007 10:18:27
Messages: 4
Offline

Is there any way to specify different client logging directories in the production configuration-model? Since the client itself is not parsing the tc-config.xml, it looks like there is no variable replacement going on on the client side when the client downloads the configuration from the Terracotta server. All I get are directories named something like ${tc.logDir} when I used production configuration-model.
gkeim

ophanim

Joined: 12/05/2006 10:22:37
Messages: 685
Location: Terracotta, Inc.
Offline

Actually, the client is parsing the remotely accessed configuration.
You need to use % instead of $ for specifying Java system properties.
Environment variables are not considered, if that's what you were hoping for.

Gary Keim (terracotta developer) Want to post to this forum? Join the Terracotta Community
 
Forum Index -> Terracotta for Spring
Go to:   
Powered by JForum 2.1.7 © JForum Team