You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Kawthar Bt M Sulaiman <mk...@maxis.com.my> on 2004/03/30 11:58:52 UTC

Newbie: Log4j print to console, not to a file.

Hello,

I just started to use Log4j today and I'm still confused after reading
some document on apache website.
This is what I've done, so pls let me know what else I have missed:

I'm using Tomcat 4.1.30 with Windows 2000.

1.  Move the log4j.properties file to
%CATALINA_HOME%\webapps\ROOT\WEB-INF\classes\
     The file contains:
     log4j.rootCategory=INFO, LOGFILE

    log4j.appender.LOGFILE = org.apache.log4j.FileAppender
    log4j.appender.LOGFILE = c:\temp\ECPA.log
   ...

2.  In my code, I replaced all my System.out with logger:
     Logger logger = Logger.getLogger("ECPA");
     logger.info("<messge>").

3.  Result, all the messages goes to my command prompt window where I
started my Tomcat and not to a file.
     I searched for the ECPA.log file but it was not created.

What is the right way to use Log4j?

Thanks,
--Kawthar

Confidential information may be contained in this e-mail and any files transmitted with it ('Message'). If you are not the addressee indicated in this Message (or responsible for delivery of this Message to such person), you are hereby notified that any dissemination, distribution, printing or copying of this Message or any part thereof is strictly prohibited. In such a case, you should delete this Message immediately and advise the sender by return e-mail. Opinions, conclusions and other information in this Message that do not relate to the official business of Maxis shall be understood as neither given nor endorsed by Maxis.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Newbie: Log4j print to console, not to a file.

Posted by Jean Charles Jabouille <JE...@BULL.NET>.
Hi, you can try this. Add this line:

log4j.logger.ECPA=debug, LOGFILE




Kawthar Bt M Sulaiman wrote:

> Hello,
>
> I just started to use Log4j today and I'm still confused after reading
> some document on apache website.
> This is what I've done, so pls let me know what else I have missed:
>
> I'm using Tomcat 4.1.30 with Windows 2000.
>
> 1.  Move the log4j.properties file to
> %CATALINA_HOME%\webapps\ROOT\WEB-INF\classes\
>      The file contains:
>      log4j.rootCategory=INFO, LOGFILE
>
>     log4j.appender.LOGFILE = org.apache.log4j.FileAppender
>     log4j.appender.LOGFILE = c:\temp\ECPA.log
>    ...
>
> 2.  In my code, I replaced all my System.out with logger:
>      Logger logger = Logger.getLogger("ECPA");
>      logger.info("<messge>").
>
> 3.  Result, all the messages goes to my command prompt window where I
> started my Tomcat and not to a file.
>      I searched for the ECPA.log file but it was not created.
>
> What is the right way to use Log4j?
>
> Thanks,
> --Kawthar
>
> Confidential information may be contained in this e-mail and any files transmitted with it ('Message'). If you are not the addressee indicated in this Message (or responsible for delivery of this Message to such person), you are hereby notified that any dissemination, distribution, printing or copying of this Message or any part thereof is strictly prohibited. In such a case, you should delete this Message immediately and advise the sender by return e-mail. Opinions, conclusions and other information in this Message that do not relate to the official business of Maxis shall be understood as neither given nor endorsed by Maxis.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org