xml file can be anywhere in your classpath.
 
But you have to choose between log4j api or sun's logging in jdk.
log4j.jar should also be in the classpath with commons-logging.jar if you choose it. log4j.xml has usage precedence over the properties file.
 
you can also give a VM argument for the location of your log4j.xml like,
-Dlog4j.configuration=file:///C:/log4j.xml
 
Cheers,
 
 
-Mert
http://www.jroller.com/page/mert

 
On 3/30/06, Eduardo Dudu Ivan Pichler <[EMAIL PROTECTED]> wrote:
this is exactly what I need Mert, but I put this file on my /web-inf/classes/ but the web application is not founding the file log4j.xml.
Are there a parameter to be setted?
thanks again

On 3/28/06, Mert Çalışkan <[EMAIL PROTECTED] > wrote:
You can define a log4j.xml in your classpath i definitely suggest you to use commons-logging. Here is an example log4j.xml. You can define multiple loggers with different package names. By this you can discriminate your application ( tr.yourpackagename) log. You can also add other appenders.
 

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOG4J" "log4j.dtd">
<log4j:configuration xmlns:log4j=" http://jakarta.apache.org/log4j/">

    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss,SSS} - %p - %C{1}.%M(%L) | %m%n"/>
        </layout>
    </appender>

    <logger name="org.hibernate">
        <level value="ERROR"/>
    </logger>

    <logger name="org.springframework">
        <level value="DEBUG"/>
    </logger>

    <logger name="tr.yourpackagename">
        <level value="DEBUG"/>
    </logger>

    <root>
        <level value="DEBUG"/>
        <appender-ref ref="CONSOLE"/>
    </root>

</log4j:configuration>


 
On 3/27/06, Dudu <[EMAIL PROTECTED] > wrote:
I have a log4j.properties file, but I want it only to logs generated by my application...
How can I do this... the better way... are there a way to disable the logs of myfaces, in the web.xml ???

Thanks

 



--
----------
Dudu
GoogleTalk: eduardopichler[at]gmail[dot]com
skype:eduardopichler

Reply via email to