Chainsaw Tab identifier
Hello, I'm trying to figure out what things I need to place in my Tab identifier field to filter out my applications. I'm using log4j v 1.2.13 and chainsaw v2. I have two applications running on the same server and both are using a socketHubAppender on different ports. I don't have any location info so the default "PROP.hostName - PROP.application" only separates by hostname and since I'm running two apps on the same server I get both logs dumped to the same tab. I've tried adding PROP.remoteSourceInfo (since that is a column in the logs that shows up and has the port number listed) and that property appears to return nothing. It's my understanding that the location info does not work in log4j 1.2.X. So my question is two fold. Is there some reference that I can look at that will tell me what properties are available, and can someone tell me how I would go about doing this? I see in the comments for LoggingEventFieldResolver the following field are available but nothing here seems like it will work for me. Plus there seems to be no explanation of what keyName is in PROP.keyName. * Field NameField value (String representationReturn type * LOGGERcategory name (logger)String * LEVEL level Level * CLASS locationInformation's class name String * FILE locationInformation's file name String * LINE locationInformation's line number String * METHODlocationInformation's method name String * MSG message Object * NDC NDC String * EXCEPTION throwable string representation ThrowableInformation * TIMESTAMP timestamp Long * THREAD threadString * PROP.keyName entry in the Property hashtable String * mapped to the key [keyName] Any help would be appreciated. Jason Tholstrup - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Chainsaw Tab identifier
Thanks Scott that was very helpful (and fast). Am I missing the reference to what Prop keyNames are available? It would be nice to know what is available (who knows maybe I'll find something i didn't know i couldn't live without). Even if it's just a matter of looking at the right javadocs that's enough. I'd just like to be able to tinker on my own. Thanks for all your hard work. Chainsaw is pretty cool. Jason Tholstrup Software Engineer [EMAIL PROTECTED] On Mar 3, 2008, at 11:42 AM, Scott Deboy wrote: Two things: 1. To get every socketappender connection to display in its own tab in Chainsaw, use PROP.log4j.remoteSourceInfo as the tab identifier (note the log4j. in front of the property name - log4j. isn't some special property name, that's just the name of the property). 2. The 'application' property on socketappender is how you route events to different tabs when the two apps are running on the same server and using socketappender. Here's an example of that config: class="org.apache.log4j.net.SocketAppender"> Use a different value in the 'application' param for each of the socketappender configs and you should be fine. Scott Deboy Principal Engineer COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Office: 503.224.7496 Direct Line: 503.821.6482 Cell: 503.997.1367 Fax: 503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Jason Tholstrup [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2008 9:24 AM To: log4j-user@logging.apache.org Subject: Chainsaw Tab identifier Hello, I'm trying to figure out what things I need to place in my Tab identifier field to filter out my applications. I'm using log4j v 1.2.13 and chainsaw v2. I have two applications running on the same server and both are using a socketHubAppender on different ports. I don't have any location info so the default "PROP.hostName - PROP.application" only separates by hostname and since I'm running two apps on the same server I get both logs dumped to the same tab. I've tried adding PROP.remoteSourceInfo (since that is a column in the logs that shows up and has the port number listed) and that property appears to return nothing. It's my understanding that the location info does not work in log4j 1.2.X. So my question is two fold. Is there some reference that I can look at that will tell me what properties are available, and can someone tell me how I would go about doing this? I see in the comments for LoggingEventFieldResolver the following field are available but nothing here seems like it will work for me. Plus there seems to be no explanation of what keyName is in PROP.keyName. * Field NameField value (String representationReturn type * LOGGERcategory name (logger)String * LEVEL level Level * CLASS locationInformation's class name String * FILE locationInformation's file name String * LINE locationInformation's line number String * METHODlocationInformation's method name String * MSG message Object * NDC NDC String * EXCEPTION throwable string representation ThrowableInformation * TIMESTAMP timestamp Long * THREAD threadString * PROP.keyName entry in the Property hashtable String * mapped to the key [keyName] Any help would be appreciated. Jason Tholstrup - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Chainsaw Tab identifier
Sorry Scott I had not tried your instructions before I replied last time. I can get PROP.log4j.remoteSourceInfo to show up in my tab identifier but PROP.application does not seem to work (which to be honest is much closer to what I want). I've seen that there is an issue with the serialized object translation from the 1.2.X branch to the 1.3 based chainsaw v2 download, and I don't receive Class, Method, File, or Line information in my logs. Is this possibly the reason PROP.application does not show up, or is there something else I have missed? Here is the log4j.properties snippet for my app. I've bounced my server container just to make sure it reloaded and PROP.application continues to return nothing in chainsaw log4j.properties sinppet (on server) log4j.appender.HUB=org.apache.log4j.net.SocketHubAppender log4j.appender.HUB.port=9005 log4j.appender.HUB.LocationInfo=true log4j.appender.HUB.Threshold=DEBUG log4j.appender.HUB.application=SES Test Tab identifier string PROP.application - PROP.log4j.remoteSourceInfo chainsaw.xml ?xml version="1.0" encoding="UTF-8" ?> http://jakarta.apache.org/log4j/"; debug="true"> class="org.apache.log4j.net.SocketHubReceiver"> Jason Tholstrup On Mar 3, 2008, at 11:42 AM, Scott Deboy wrote: Two things: 1. To get every socketappender connection to display in its own tab in Chainsaw, use PROP.log4j.remoteSourceInfo as the tab identifier (note the log4j. in front of the property name - log4j. isn't some special property name, that's just the name of the property). 2. The 'application' property on socketappender is how you route events to different tabs when the two apps are running on the same server and using socketappender. Here's an example of that config: class="org.apache.log4j.net.SocketAppender"> Use a different value in the 'application' param for each of the socketappender configs and you should be fine. Scott Deboy Principal Engineer COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Office: 503.224.7496 Direct Line: 503.821.6482 Cell: 503.997.1367 Fax: 503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Jason Tholstrup [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2008 9:24 AM To: log4j-user@logging.apache.org Subject: Chainsaw Tab identifier Hello, I'm trying to figure out what things I need to place in my Tab identifier field to filter out my applications. I'm using log4j v 1.2.13 and chainsaw v2. I have two applications running on the same server and both are using a socketHubAppender on different ports. I don't have any location info so the default "PROP.hostName - PROP.application" only separates by hostname and since I'm running two apps on the same server I get both logs dumped to the same tab. I've tried adding PROP.remoteSourceInfo (since that is a column in the logs that shows up and has the port number listed) and that property appears to return nothing. It's my understanding that the location info does not work in log4j 1.2.X. So my question is two fold. Is there some reference that I can look at that will tell me what properties are available, and can someone tell me how I would go about doing this? I see in the comments for LoggingEventFieldResolver the following field are available but nothing here seems like it will work for me. Plus there seems to be no explanation of what keyName is in PROP.keyName. * Field NameField value (String representationReturn type * LOGGERcategory name (logger)String * LEVEL level Level * CLASS locationInformation's class name String * FILE locationInformation's file name String * LINE locationInformation's line number String * METHODlocationInformation's method name String * MSG message Object * NDC NDC String * EXCEPTION throwable string representation ThrowableInformation * TIMESTAMP timestamp Long * THREAD threadString * PROP.keyName entry in the Property hashtable String * mapped to the key [keyName] Any help would be appreciated. Jason Tholstrup - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMA
Re: Chainsaw Tab identifier
I'm sure you get this a lot but after reading quite a few posts I am still kind of confused: The lineage between the 1.3 and 1.2 branches is very hazy. From what i can tell 1.3 is essentially dead and that 1.2 is the recommended version to use. As for chainsaw, should I be using the v2 that is available directly on apache's web site? This appears to be based on version 1.3 code if I read correctly. Should I instead be using version 1.2.15 and using the chainsaw client available from there as well as using log4j 1.2.15 on my appender side? I've seen posts mentioning getting the latest 1.2.15 version from svn to get the "right" version of chainsaw. Is that now current with the latest release or do I still need to tread into the waters of a nightly build? On the back porting effort, what is the status there? Is that completed and that is the purpose of 1.2.15? Is that just a partial back-port with more to come? Is that a partial back-port and that's the end of the road? And finally we have a third party app we were trying to get logging working under that is using 1.2.9. Could we safely drop in 1.2.15 and be able to configure our appenders as you describe (we have access to the log4j.properties file on the server)? Thanks for being patient and walking me through all of this. You've easily save me a couple of days of bumbling around trying to get this to work. Jason Tholstrup Software Engineer [EMAIL PROTECTED] On Mar 3, 2008, at 3:52 PM, Scott Deboy wrote: SocketHubAppender doesn't have the 'application' property support built into the appender like 1.2.15 socketappender does, so to use the application property with sockethubappender, you'd have to: - use log4j 1.2.15 on the appender side - also include the receivers companion in the classpath - specify a rewriteappender which adds the 'application' property and forwards events to the sockethubappender I haven't tested that, but it should work.. Btw, log4j 1.3 sockethubappender supported a 'buffersize' param which would forward the last X events to the connecting sockethubreceiver, but it doesn't look like that was back-ported to log4j 1.2.15. Scott Deboy Principal Engineer COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Office: 503.224.7496 Direct Line: 503.821.6482 Cell: 503.997.1367 Fax: 503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Jason Tholstrup [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2008 12:57 PM To: Log4J Users List Subject: Re: Chainsaw Tab identifier Sorry Scott I had not tried your instructions before I replied last time. I can get PROP.log4j.remoteSourceInfo to show up in my tab identifier but PROP.application does not seem to work (which to be honest is much closer to what I want). I've seen that there is an issue with the serialized object translation from the 1.2.X branch to the 1.3 based chainsaw v2 download, and I don't receive Class, Method, File, or Line information in my logs. Is this possibly the reason PROP.application does not show up, or is there something else I have missed? Here is the log4j.properties snippet for my app. I've bounced my server container just to make sure it reloaded and PROP.application continues to return nothing in chainsaw log4j.properties sinppet (on server) log4j.appender.HUB=org.apache.log4j.net.SocketHubAppender log4j.appender.HUB.port=9005 log4j.appender.HUB.LocationInfo=true log4j.appender.HUB.Threshold=DEBUG log4j.appender.HUB.application=SES Test Tab identifier string PROP.application - PROP.log4j.remoteSourceInfo chainsaw.xml ?xml version="1.0" encoding="UTF-8" ?> http://jakarta.apache.org/log4j/"; debug="true"> Jason Tholstrup On Mar 3, 2008, at 11:42 AM, Scott Deboy wrote: Two things: 1. To get every socketappender connection to display in its own tab in Chainsaw, use PROP.log4j.remoteSourceInfo as the tab identifier (note the log4j. in front of the property name - log4j. isn't some special property name, that's just the name of the property). 2. The 'application' property on socketappender is how you route events to different tabs when the two apps are running on the same server and using socketappender. Here's an example of that config: Use a different value in the 'application' param for each of the socketappender configs and you should be fine. Scott Deboy Principal Engineer COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Office: 503.224.7496 Direct Line: 503.821.6482 Cell: 503.997.1367 Fax: 503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Jason Tholstrup [mailto:[EMAIL PROTECTED] Sent: Monday, March
Re: Chainsaw Tab identifier
Hey Scott, Thanks so much for the help. I've started creating a custom version of the SocketHubAppender which implements the buffer you mentioned (Yanked the code from the 1.3 branch and it works like a charm. Thanks for mentioning it). I also tried to set the "application" property into this custom Appender using the code from SocketAppender as a template. I am not getting the application property to come across the wire, nor can I seem to get any property to come across the wire. I get the remoteSourceInfo, hostname, and log4jid to come across but I'm guessing that is happening on the chainsaw side. From digging through the 1.2 and 1.3 code bases I noticed that the LoggingEvent seems to handle properties differently. The 1.2 code base uses the mdc to set the property in and the 1.3 code base uses the properties map. Am I running into another incompatibility issue between log4j 1.2.15 on the server side and chainsaw (log4j 1.3 version) or am I completely missing the point of how I set properties? Code snippet from socketHubAppender where I set properties on the logging event. I've debugged through here and verified that the properties exist in the mdc on the LoggingEvent. /** * Append an event to all of current connections. */ public void append(LoggingEvent event) { // if no event or no open connections, exit now if (event == null || oosList.size() == 0) return; // set up location info if requested if (locationInfo) { event.getLocationInformation(); } if (buffer != null) { buffer.add(event); } if (application != null) { // set application name event.setProperty("application", application); } // set property all the time name event.setProperty("randomProp", "hello"); ... /** * The App option takes a string value which should be the name of the application getting logged. If property was already set (via system * property), don't set here. */ public void setApplication(String lapp) { this.application = lapp; } /** * Returns value of the Application option. */ public String getApplication() { return application; } Jason Tholstrup Software Engineer [EMAIL PROTECTED] On Mar 3, 2008, at 4:49 PM, Scott Deboy wrote: log4j 1.3 is abandoned - the useful bits were (mostly) backported to log4j 1.2.15 with a few 'companion' downloads providing the non-core functionality added to 1.3. There are a few caveats: - Chainsaw V2 trunk (built against log4j 1.2.15) has not yet been released. Once it is released, location info will work again. - The version of Chainsaw available via web start is based on log4j 1.3, so location info won't work - The component, receivers and zeroconf 'companions' have not yet been officially released - the 'extras' companion has been officially released (meaning any not-yet-released companions need to be built from source..) Since Chainsaw V2 built against log4j 1.2.15 (along with the receivers and other companions) have yet to be officially released, it's a pain to build Chainsaw on the trunk (maven dependencies on snapshots...ug). As for compatibility between log4j 1.2.15 (and Chainsaw V2) and prior versions, Chainsaw V2 should work fine with log4j 1.2.9 (including support for location info). Everything we wanted to keep -should- already be backported to log4j 1.2.15 + companions..the sockethubappender buffer issue is one that was missed.. Once everything is released, it'll be a lot easier to build from sources. Scott Deboy Principal Engineer COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Office: 503.224.7496 Direct Line: 503.821.6482 Cell: 503.997.1367 Fax: 503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Jason Tholstrup [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2008 2:30 PM To: Log4J Users List Subject: Re: Chainsaw Tab identifier I'm sure you get this a lot but after reading quite a few posts I am still kind of confused: The lineage between the 1.3 and 1.2 branches is very hazy. From what i can tell 1.3 is essentially dead and that 1.2 is the recommended version to use. As for chainsaw, should I be using the v2 that is available directly on apache's web site? This appears to be based on version 1.3 code if I read correctly. Should I instead be using version 1.2.15 and using the chainsaw client available from there as well as using log4j 1.2.15 on my appender
Re: Chainsaw Tab identifier
Yeah Scott I actually got the 1.2.15 branch of chainsaw built last night. You guys have documented the build process pretty well so it wasn't too bad. (I especially like the mac-app builder). I'm already back porting the bufferSize stuff that you mentioned so the application bit is no big deal. Once I've got this all flushed out and working would you like me to send you the upgraded version of SocketHubAppender? Any guide lines I'd need to follow to contribute it back? Jason Tholstrup Software Engineer [EMAIL PROTECTED] On Mar 6, 2008, at 11:12 AM, Scott Deboy wrote: You're right, the properties you mentioned are generated on the Chainsaw side (hostname can be provided by the server side, if it's not, Chainsaw will parse log4j.remoteSourceInfo and set it). I'm not sure why properties aren't working, but you're probably right - changes to loggingevent's serialization of properties is different between 1.2 and 1.3, and you're probably running into that issue. To get location info (and properties) to work, you'll need to pull Chainsaw from svn trunk and build it using maven. There are a number of dependencies, including the companions, all of which aren't yet released, so it's a bit of a hassle. Once you have Chainsaw from trunk and you're using log4j 1.2.15 on the appender side, everything will work. You don't -have- to add support for the application property directly in the sockethubappender (unless you want to) - you could wrap your socketappender with a rewriteappender which specifies a PropertyRewritePolicy. This will allow you to add properties through the config file. Hope that helps, Scott Deboy Principal Engineer COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Office: 503.224.7496 Direct Line: 503.821.6482 Cell: 503.997.1367 Fax: 503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Jason Tholstrup [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2008 2:21 PM To: Log4J Users List Subject: Re: Chainsaw Tab identifier Hey Scott, Thanks so much for the help. I've started creating a custom version of the SocketHubAppender which implements the buffer you mentioned (Yanked the code from the 1.3 branch and it works like a charm. Thanks for mentioning it). I also tried to set the "application" property into this custom Appender using the code from SocketAppender as a template. I am not getting the application property to come across the wire, nor can I seem to get any property to come across the wire. I get the remoteSourceInfo, hostname, and log4jid to come across but I'm guessing that is happening on the chainsaw side. From digging through the 1.2 and 1.3 code bases I noticed that the LoggingEvent seems to handle properties differently. The 1.2 code base uses the mdc to set the property in and the 1.3 code base uses the properties map. Am I running into another incompatibility issue between log4j 1.2.15 on the server side and chainsaw (log4j 1.3 version) or am I completely missing the point of how I set properties? Code snippet from socketHubAppender where I set properties on the logging event. I've debugged through here and verified that the properties exist in the mdc on the LoggingEvent. /** * Append an event to all of current connections. */ public void append(LoggingEvent event) { // if no event or no open connections, exit now if (event == null || oosList.size() == 0) return; // set up location info if requested if (locationInfo) { event.getLocationInformation(); } if (buffer != null) { buffer.add(event); } if (application != null) { // set application name event.setProperty("application", application); } // set property all the time name event.setProperty("randomProp", "hello"); ... /** * The App option takes a string value which should be the name of the application getting logged. If property was already set (via system * property), don't set here. */ public void setApplication(String lapp) { this.application = lapp; } /** * Returns value of the Application option. */ public String getApplication() { return application; } Jason Tholstrup Software Engineer [EMAIL PROTECTED] On Mar 3, 2008, at 4:49 PM, Scott Deboy wrote: log4j 1.3 is abandoned - the useful bits were (mostly) backported to log4j 1.2.15 with a few 'companion' downloads providing the