Redirect errors and debug to file with log4j with log4j.properties

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Redirect errors and debug to file with log4j with log4j.properties

Luis tuti
Hi,

I'm trying to redirect java errors to file. I've modified log4j propierties
file but I can't see errors in file My log4j.propierties is:

log4j.appender.FILE.File=${user.home}/log2.out
log4j.rootLogger = DEBUG, FILE
log4j.rootLogger = ERROR, FILE

# Define the file appender
log4j.appender.FILE=org.apache.log4j.FileAppender
# Define the layout for file appender
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L    -
%m%n

Could you help me? Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Redirect errors and debug to file with log4j with log4j.properties

Matt Sicker
This is from version 1 which is no longer supported here as of a few
years ago. I'd recommend upgrading to version 2.x if you can.

On Tue, 14 May 2019 at 06:31, Luis tuti <[hidden email]> wrote:

>
> Hi,
>
> I'm trying to redirect java errors to file. I've modified log4j propierties
> file but I can't see errors in file My log4j.propierties is:
>
> log4j.appender.FILE.File=${user.home}/log2.out
> log4j.rootLogger = DEBUG, FILE
> log4j.rootLogger = ERROR, FILE
>
> # Define the file appender
> log4j.appender.FILE=org.apache.log4j.FileAppender
> # Define the layout for file appender
> log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
> log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L    -
> %m%n
>
> Could you help me? Thanks



--
Matt Sicker <[hidden email]>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Redirect errors and debug to file with log4j with log4j.properties

Ralph Goers
In reply to this post by Luis tuti
Although you generally won’t find much help here since Log4j 1 was retired years ago, I find myself wondering why you have 2 root logger declarations. That is bound to cause problems.

Ralph

> On May 14, 2019, at 4:30 AM, Luis tuti <[hidden email]> wrote:
>
> Hi,
>
> I'm trying to redirect java errors to file. I've modified log4j propierties
> file but I can't see errors in file My log4j.propierties is:
>
> log4j.appender.FILE.File=${user.home}/log2.out
> log4j.rootLogger = DEBUG, FILE
> log4j.rootLogger = ERROR, FILE
>
> # Define the file appender
> log4j.appender.FILE=org.apache.log4j.FileAppender
> # Define the layout for file appender
> log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
> log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L    -
> %m%n
>
> Could you help me? Thanks



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]