Here's my log4j.properties:

# define the root logger with two appenders writing to console and file
log4j.rootLogger=INFO, CONSOLE, FILE

#define the appender named CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.conversionPattern=%d{dd-MMM-yyyy HH:mm:ss.SSS} [%t] %-5p %c %x - %m%n

#define the appender named FILE
log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.conversionPattern=%d{dd-MMM-yyyy HH:mm:ss.SSS} [%t] %-5p %c %x - %m%n
log4j.appender.FILE.File=${logs.dir}/mylog.log
log4j.appender.FILE.DatePattern='.'yyyy-MM


And to write to the log file, in my code I do this:

                logger = LoggerFactory.getLogger(MappingServer.class);
...
                logger.info("Started core server components");

etc.

HTH,

DR

motum hesa wrote:
No, maybe I don't explain me very well, I want to put in a file the
logs of my mina application, I have log4j.properies, I have lib4j
libraries, the file is created, but it's empty, I use Netbeans, I
understand that the log4j configuration is correct, the problem is
that I don't know how redirect mina logs to a file. Thanks..


2009/6/29 Mark Webb <[email protected]>:
Do the examples have log4j.properties files in them?


------Original Message------
From: motum hesa
To: [email protected]
ReplyTo: [email protected]
Subject: logging to file with log4j
Sent: Jun 29, 2009 7:53 PM

Hi, I want to an example or where found an example abuout how use
slf4j with log4j for put the logs into a file with apache mina...
Thanks for your help...

Roberto Campos

Reply via email to