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 Johnny Gonzalez <jo...@yahoo.es> on 2004/12/30 18:33:50 UTC
Loading configuration file
Hello Everybody.
How can I load mi own configuration file?
I'm working with eclipse 3.0 in a standalone
application,
I have the file log4j-1.2.7 in my java build path.
I have my configuration file (log4.props) into the
project. In this configuration file I setting some
files in which to save the logs, but after sending
logs through my application, nothing happens in my log
files, but it displays in the console the appropiate
messages. Do I have to tell log4j where is my
configuration file? How can I do this?
This is my configuration file:
#coloca los niveles de los loggers en debug y error,
y adiciona appenders
log4j.logger.co.com=DEBUG,ap1,ap2
log4j.logger.erroresStack=ERROR,ap3
#configuracion del appender 1
log4j.appender.ap1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ap1.DatePattern='.'yyyy-MM-dd
log4j.appender.ap1.File=logSEMC.txt
log4j.appender.ap1.threshold=DEBUG
#configuracion del appender 3
log4j.appender.ap3=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ap3.DatePattern='.'yyyy-MM-dd
log4j.appender.ap3.File=logSEMCErrores.txt
log4j.appender.ap3.threshold=ERROR
#configuracion del apender 2
log4j.appender.ap2=org.apache.log4j.ConsoleAppender
#layouts para los appenders
log4j.appender.ap1.layout=org.apache.log4j.PatternLayout
log4j.appender.ap1.layout.ConversionPattern=%d [%t]
%-5p %c - %m%n
log4j.appender.ap2.layout=org.apache.log4j.PatternLayout
log4j.appender.ap2.layout.ConversionPattern=%d [%t]
%-5p %c - %m%n
log4j.appender.ap3.layout=org.apache.log4j.PatternLayout
log4j.appender.ap3.layout.ConversionPattern=%d [%t]
%-5p %c - %m%n
______________________________________________
Renovamos el Correo Yahoo!: ¡250 MB GRATIS!
Nuevos servicios, más seguridad
http://correo.yahoo.es
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Loading configuration file
Posted by Johnny Gonzalez <jo...@yahoo.es>.
Hello Jake,
Thanks a lot for your recomendation, I think, I will
first go to update to the latest release, then I will
change my proprerties file to one of the
recommendations you are making.
Thanks again,
Johnny
--- Jacob Kjome <ho...@visi.com> escribió:
>
> Log4j looks for "log4j.properties" and "log4j.xml"
> in the default
> package. "log4j.props" or any name other than the
> two I mentioned will not
> be picked up for auto configuration. Also, you
> might want to upgrade to
> 1.2.9. I can't remember the version that started
> picking up "log4j.xml",
> but I know for sure that both 1.2.8 and 1.2.9 do.
>
> Jake
>
> At 06:33 PM 12/30/2004 +0100, you wrote:
> >Hello Everybody.
> >
> >How can I load mi own configuration file?
> >
> > I'm working with eclipse 3.0 in a standalone
> >application,
> >I have the file log4j-1.2.7 in my java build path.
> >I have my configuration file (log4.props) into the
> >project. In this configuration file I setting some
> >files in which to save the logs, but after sending
> >logs through my application, nothing happens in my
> log
> >files, but it displays in the console the
> appropiate
> >messages. Do I have to tell log4j where is my
> >configuration file? How can I do this?
> >
> >This is my configuration file:
> >#coloca los niveles de los loggers en debug y
> error,
> >y adiciona appenders
> >log4j.logger.co.com=DEBUG,ap1,ap2
> >log4j.logger.erroresStack=ERROR,ap3
> >
> >#configuracion del appender 1
>
>
>log4j.appender.ap1=org.apache.log4j.DailyRollingFileAppender
> >log4j.appender.ap1.DatePattern='.'yyyy-MM-dd
> >log4j.appender.ap1.File=logSEMC.txt
> >log4j.appender.ap1.threshold=DEBUG
> >
> >#configuracion del appender 3
>
>
>log4j.appender.ap3=org.apache.log4j.DailyRollingFileAppender
> >log4j.appender.ap3.DatePattern='.'yyyy-MM-dd
> >log4j.appender.ap3.File=logSEMCErrores.txt
> >log4j.appender.ap3.threshold=ERROR
> >
> >#configuracion del apender 2
>
> >log4j.appender.ap2=org.apache.log4j.ConsoleAppender
> >
> >#layouts para los appenders
>
>
>log4j.appender.ap1.layout=org.apache.log4j.PatternLayout
> >log4j.appender.ap1.layout.ConversionPattern=%d
> [%t]
> >%-5p %c - %m%n
> >
>
>
>log4j.appender.ap2.layout=org.apache.log4j.PatternLayout
> >log4j.appender.ap2.layout.ConversionPattern=%d
> [%t]
> >%-5p %c - %m%n
> >
>
>
>log4j.appender.ap3.layout=org.apache.log4j.PatternLayout
> >log4j.appender.ap3.layout.ConversionPattern=%d
> [%t]
> >%-5p %c - %m%n
> >
> >
> >
> >______________________________________________
> >Renovamos el Correo Yahoo!: ¡250 MB GRATIS!
> >Nuevos servicios, más seguridad
> >http://correo.yahoo.es
> >
>
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> log4j-user-unsubscribe@logging.apache.org
> >For additional commands, e-mail:
> log4j-user-help@logging.apache.org
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail:
> log4j-user-help@logging.apache.org
>
>
______________________________________________
Renovamos el Correo Yahoo!: ¡250 MB GRATIS!
Nuevos servicios, más seguridad
http://correo.yahoo.es
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Loading configuration file
Posted by Jacob Kjome <ho...@visi.com>.
Log4j looks for "log4j.properties" and "log4j.xml" in the default
package. "log4j.props" or any name other than the two I mentioned will not
be picked up for auto configuration. Also, you might want to upgrade to
1.2.9. I can't remember the version that started picking up "log4j.xml",
but I know for sure that both 1.2.8 and 1.2.9 do.
Jake
At 06:33 PM 12/30/2004 +0100, you wrote:
>Hello Everybody.
>
>How can I load mi own configuration file?
>
> I'm working with eclipse 3.0 in a standalone
>application,
>I have the file log4j-1.2.7 in my java build path.
>I have my configuration file (log4.props) into the
>project. In this configuration file I setting some
>files in which to save the logs, but after sending
>logs through my application, nothing happens in my log
>files, but it displays in the console the appropiate
>messages. Do I have to tell log4j where is my
>configuration file? How can I do this?
>
>This is my configuration file:
>#coloca los niveles de los loggers en debug y error,
>y adiciona appenders
>log4j.logger.co.com=DEBUG,ap1,ap2
>log4j.logger.erroresStack=ERROR,ap3
>
>#configuracion del appender 1
>log4j.appender.ap1=org.apache.log4j.DailyRollingFileAppender
>log4j.appender.ap1.DatePattern='.'yyyy-MM-dd
>log4j.appender.ap1.File=logSEMC.txt
>log4j.appender.ap1.threshold=DEBUG
>
>#configuracion del appender 3
>log4j.appender.ap3=org.apache.log4j.DailyRollingFileAppender
>log4j.appender.ap3.DatePattern='.'yyyy-MM-dd
>log4j.appender.ap3.File=logSEMCErrores.txt
>log4j.appender.ap3.threshold=ERROR
>
>#configuracion del apender 2
>log4j.appender.ap2=org.apache.log4j.ConsoleAppender
>
>#layouts para los appenders
>log4j.appender.ap1.layout=org.apache.log4j.PatternLayout
>log4j.appender.ap1.layout.ConversionPattern=%d [%t]
>%-5p %c - %m%n
>
>log4j.appender.ap2.layout=org.apache.log4j.PatternLayout
>log4j.appender.ap2.layout.ConversionPattern=%d [%t]
>%-5p %c - %m%n
>
>log4j.appender.ap3.layout=org.apache.log4j.PatternLayout
>log4j.appender.ap3.layout.ConversionPattern=%d [%t]
>%-5p %c - %m%n
>
>
>
>______________________________________________
>Renovamos el Correo Yahoo!: ¡250 MB GRATIS!
>Nuevos servicios, más seguridad
>http://correo.yahoo.es
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org