Re: AW: Help Log4j Chainsaw - VFSLogFilePatternReceiver Usage
But in this case we're viewing a previously/currently written log4j file, hence the parsing. If you use a socket appender you can have Chainsaw capture the actual message events, just as you suggest. However, that may not be possible, nor even desirable, in many cases. I'm sure Scott Deboy can tell you more. Jake On 7/26/2011 12:49 AM, Stadelmann Josef wrote: Are you saying you write a parser for log file entries? Hmm. Why not taking log4j sources and find the point where you can catch the message events, the real objects and massage this objects. I say that because you say: Everything is displayed under Message column. Getting access to the Message Event objects would allow you to check certain fields and then access much better what you may call part of the message column content. So the question be allowed; why parsin? What do you like to parse, find, filter out? And yes. Unless you have a clear idea about how your real-messages must be structured it is even hard to write a working parser. Josef -Ursprüngliche Nachricht- Von: Ding, Qin [mailto:qin.d...@jpmchase.com] Gesendet: Montag, 25. Juli 2011 17:28 An: Log4J Users List Betreff: RE: Help Log4j Chainsaw - VFSLogFilePatternReceiver Usage Thank you Scott. It works for the local log file. Everything is displayed under Message column. I guess I need to try the different format to see how to parse the log file correctly. One reason it does not parse correctly is that the log entries are not always consistent. Once in a while there is a plain text entry shown up. I will try sftp again soon. Once again, thank you. QD -Original Message- From: Scott Deboy [mailto:scott.de...@gmail.com] Sent: Thursday, July 21, 2011 5:04 PM To: Log4J Users List Subject: Re: Help Log4j Chainsaw - VFSLogFilePatternReceiver Usage Here you go.. 1. start chainsaw 2. Choose the file, load chainsaw configuration menu item 3. When the dialog opens, choose the 'process a log file' option 4. Click the 'open file' button and choose the local file you'd like to process, or manually enter the sftp:// URL you want to use (I'd first try with a local file just to make sure it works, but once it is working, you can just change this to your sftp URL). 5. Leave Log file format type as 'LogFilePatternReceiver LogFormat' 6. Click the down arrow next to the Log file format drop down and choose 'MESSAGE' (it will put the entire log line in the 'message' field but you won't have issues with mismatched log entries, so we will see events come in to a tab). 7.don't worry about Log file timestamp format, since you don't have TIMESTAMP field defined in your log format 8. Click 'save configuration as' and browse to where you want to save it and give it a name (I just entered 'c:\new-logfile-receiver-config.xml' in the box) 9. Click the 'always start chainsaw with this configuration button' 10. Press ok Events should show up in a new tab, the tab name being the name of the log file you chose to process. If you open the receiver panel you should see a receiver whose name is the log file you chose to process. Here is the contents of 'new-logfile-receiver-config.xml' after I did this (it did create a tab for me, and I have a receiver defined) ?xml version=1.0 encoding=UTF-8? log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true plugin class=org.apache.log4j.chainsaw.vfs.VFSLogFilePatternReceiver name=/C:/andyRILog.txt param name=appendNonMatches value=true/ param name=autoReconnect value=true/ param name=fileURL value=file:/C:/andyRILog.txt/ param name=logFormat value=MESSAGE/ param name=name value=/C:/andyRILog.txt/ param name=promptForUserInfo value=false/ param name=tailing value=true/ param name=timestampFormat value=-MM-dd HH:mm:ss,SSS/ param name=waitMillis value=2000/ /plugin /log4j:configuration Again, if you are going to try sftp after this, change promptForUserInfo to true and change your fileURL. You can play with the logFormat and timestampFormat once you have it working as well. This worked for me out of the box with the developer snapshot you downloaded from http://people.apache.org/~sdeboy Scott On Thu, Jul 21, 2011 at 2:51 PM, Ding, Qin qin.d...@jpmchase.com wrote: Scott: 1. I manually downloaded mylog.log; and define a logfilePatternReceiver within chainsaw. Pointing to mylog.log. after that, it just sits there, I see nothing. The last entry in the detail panel: setValueAt, 2, 1, value=file:///C:\MyDocs\logs\mylog.log, valueClassclass java.lang.String 2. I copied the provided configuration file and modified the VFSLogFilePatternReceiver and put it in a folder. Use the instruction you gave me to load it. But on the receiver panel I did not see anything. Manually define a VFSLogFilePatternReceiver. Don't see the GUI prompt for
AW: Help Log4j Chainsaw - VFSLogFilePatternReceiver Usage
Are you saying you write a parser for log file entries? Hmm. Why not taking log4j sources and find the point where you can catch the message events, the real objects and massage this objects. I say that because you say: Everything is displayed under Message column. Getting access to the Message Event objects would allow you to check certain fields and then access much better what you may call part of the message column content. So the question be allowed; why parsin? What do you like to parse, find, filter out? And yes. Unless you have a clear idea about how your real-messages must be structured it is even hard to write a working parser. Josef -Ursprüngliche Nachricht- Von: Ding, Qin [mailto:qin.d...@jpmchase.com] Gesendet: Montag, 25. Juli 2011 17:28 An: Log4J Users List Betreff: RE: Help Log4j Chainsaw - VFSLogFilePatternReceiver Usage Thank you Scott. It works for the local log file. Everything is displayed under Message column. I guess I need to try the different format to see how to parse the log file correctly. One reason it does not parse correctly is that the log entries are not always consistent. Once in a while there is a plain text entry shown up. I will try sftp again soon. Once again, thank you. QD -Original Message- From: Scott Deboy [mailto:scott.de...@gmail.com] Sent: Thursday, July 21, 2011 5:04 PM To: Log4J Users List Subject: Re: Help Log4j Chainsaw - VFSLogFilePatternReceiver Usage Here you go.. 1. start chainsaw 2. Choose the file, load chainsaw configuration menu item 3. When the dialog opens, choose the 'process a log file' option 4. Click the 'open file' button and choose the local file you'd like to process, or manually enter the sftp:// URL you want to use (I'd first try with a local file just to make sure it works, but once it is working, you can just change this to your sftp URL). 5. Leave Log file format type as 'LogFilePatternReceiver LogFormat' 6. Click the down arrow next to the Log file format drop down and choose 'MESSAGE' (it will put the entire log line in the 'message' field but you won't have issues with mismatched log entries, so we will see events come in to a tab). 7.don't worry about Log file timestamp format, since you don't have TIMESTAMP field defined in your log format 8. Click 'save configuration as' and browse to where you want to save it and give it a name (I just entered 'c:\new-logfile-receiver-config.xml' in the box) 9. Click the 'always start chainsaw with this configuration button' 10. Press ok Events should show up in a new tab, the tab name being the name of the log file you chose to process. If you open the receiver panel you should see a receiver whose name is the log file you chose to process. Here is the contents of 'new-logfile-receiver-config.xml' after I did this (it did create a tab for me, and I have a receiver defined) ?xml version=1.0 encoding=UTF-8? log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true plugin class=org.apache.log4j.chainsaw.vfs.VFSLogFilePatternReceiver name=/C:/andyRILog.txt param name=appendNonMatches value=true/ param name=autoReconnect value=true/ param name=fileURL value=file:/C:/andyRILog.txt/ param name=logFormat value=MESSAGE/ param name=name value=/C:/andyRILog.txt/ param name=promptForUserInfo value=false/ param name=tailing value=true/ param name=timestampFormat value=-MM-dd HH:mm:ss,SSS/ param name=waitMillis value=2000/ /plugin /log4j:configuration Again, if you are going to try sftp after this, change promptForUserInfo to true and change your fileURL. You can play with the logFormat and timestampFormat once you have it working as well. This worked for me out of the box with the developer snapshot you downloaded from http://people.apache.org/~sdeboy Scott On Thu, Jul 21, 2011 at 2:51 PM, Ding, Qin qin.d...@jpmchase.com wrote: Scott: 1. I manually downloaded mylog.log; and define a logfilePatternReceiver within chainsaw. Pointing to mylog.log. after that, it just sits there, I see nothing. The last entry in the detail panel: setValueAt, 2, 1, value=file:///C:\MyDocs\logs\mylog.log, valueClassclass java.lang.String 2. I copied the provided configuration file and modified the VFSLogFilePatternReceiver and put it in a folder. Use the instruction you gave me to load it. But on the receiver panel I did not see anything. Manually define a VFSLogFilePatternReceiver. Don't see the GUI prompt for id/pwd. Would you please give me a detailed the instruction or your working sample configuration file? Thank you QD -Original Message- From: Scott Deboy [mailto:scott.de...@gmail.com] Sent: Thursday, July 21, 2011 1:36 PM To: Log4J Users List Subject: Re: Help Log4j Chainsaw - VFSLogFilePatternReceiver Usage Chainsaw settings are stored in $userhome/.chainsaw - in that folder has a chainsaw-settings.xml file that is used to store