Follow these steps:

1.- define one file appender for app messages and one appender for
non-app messages.

2.- attach non-app appender to the root logger

3.- attach the app appender to the highest point of your app hierachy.
Here I'm assuming you app is organized with a package hierachy that
can be traced to a package that is the father of all your packages,
and that you name your loggers after your classes, i.e. if your app is
organized within a package hierachy that is called
"com.robertbowen.app.*",  you want to attach your app logger to
"com.robertbowen.app".

4.- turn off additivity in the com.robertbowen.app logger. Very
important, if you don't do this your app output will mingle with your
non-app output at the root logger.

5.- Done! With this approach, you can also have your app on DEBUG and
non-app messages on INFO or WARNING.

On 6/6/06, Robert Bowen <[EMAIL PROTECTED]> wrote:
I have been scouring the list and have found a few mentions of how to maintain 
two seperate log files but I can't find examples and in any case what I would 
like to do is something a little different although I'm sure easy to do.

My app spits out all kinds of info in a certain, precise format. Tomcat 
startup/shutdown and Java exceptions are sneaking into my log. I would like 
tobe able to have all non-app messages go to one log, and app messages to 
another.

I am using xml format andmy log4j.xml is dirt simple. Can anyone tell me how to 
do this, or point me to a link? The documentation is enormous and they seem to 
explain just about everything you can possibly do with log4j ... except what I 
want to do. :(

Thanks in advance, log4j.xml follows,
Bob


<log4j:configuration debug="true" 
xmlns:log4j="http://jakarta.apache.org/log4j/";>
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
      <appender-ref ref="DAILYFILE"/>
    </appender>

    <appender name="DAILYFILE" 
class="org.apache.log4j.DailyRollingFileAppender">
        <param name="file" value="${log.dir}vcache_sys"/>
        <param name="datePattern" value="'.'yyyy-MM-dd"/>
        <param name="threshold" value="INFO"/>
        <param name="append" value="true"/>
        <param name="immediateFlush" value="true"/>

        <layout class="org.apache.log4j.PatternLayout">
               <param name="conversionPattern" value="%m%n"/>
        </layout>
    </appender>

    <root>
        <priority value="info"/>
        <appender-ref ref="ASYNC"/>
    </root>
</log4j:configuration>

---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
countries) for 2¢/min or less.



--
Javier González Nicolini

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

Reply via email to