On 21/06/2007, at 2:50 PM, akshay kumar wrote:

Hi Paul,
  great!!..It is working fine now!
  However I got few more confusions!!..:(
1) As I am using pattern layout, I am not able to Drag and Drop this file into my chainsaw And if I use XML layout instead of patternlayout the Timestamp information comes in the log file is weird. I want the timestamp in ISO8601 format only. Please tell me what can be the solution.

The solution is to have 2 appenders: 1 in XMLLayout format, the other in the human-readable format. If you name these log files appropriately and put them side by side each other, then you can view one with some other tool, and drag it's companion XML version into Chainsaw.

2) If I want to filter the chainsaw internal logs in my log file how can I do that?

Only attach the XMLLayout and/or PatternLayout appenders to the root logger of your own package naming hierarchy. Right now you have attached them to the root logger. If your own logging events belong to, say, the 'com.mycompany.myproduct.LoggerA' Logger, then you could attach the appender to the "com.mycompany" logger. Something like:

<appender name="MyPatternLayoutAppender" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="patternlayout.log" />
        <param name="Append" value="true" />
        <param name="DatePattern" value="'.'yyyy-MM-dd" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"
                value="[%d{ISO8601} %-5p][%20.20c][%t] %m%n"
                />
        </layout>
    </appender>

....(do the same sort of thing for XML version, just use a different Layout)

....
    <!--Loggers-->
    <logger name="com.mycompany" additivity="false">
        <level value="INFO" />
        <appender-ref ref="MyXmlAppender" />
        <appender-ref ref="MyPatternLayoutAppender" />
    </logger>
...

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to