Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Open Source Projects
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Other Open Source Projects
log4j writing to multiple log
bryan lim
Ranch Hand
Posts: 140
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi all,
i tried to copy what is found here to write out to multiple logs at different location.
below is my log4j.properties:
log4j.rootLogger=debug, stdout, R log4j.logger.AppLogging=info, X log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout # Pattern to output the caller's file name and line number. log4j.appender.stdout.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=./logs/newsmachine.log log4j.appender.R.MaxFileSize=1000KB log4j.appender.X.File=./logs/email.log log4j.appender.X.MaxFileSize=1000KB # Keep one backup file log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.appender.X.MaxBackupIndex=1 log4j.appender.X.layout=org.apache.log4j.PatternLayout log4j.appender.X.layout.ConversionPattern=%p %t %c - %m%n
i put these in my class:
i wonder what is wrong and my rootlogger is sitting in the same class. will that be a problem?
static Logger logger1 = Logger.getLogger("Application"); logger1.info("writing to multiple log");
regards
bryan
bryan lim
Ranch Hand
Posts: 140
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
forgot to paste the link
http://marc.info/?l=log4j-user&m=106933367632288&w=2
Martijn Verburg
author
Posts: 3285
13
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Your static Logger logger1 = Logger.getLogger("Application"); needs to read static Logger logger1 = Logger.getLogger("AppLogging"); as that's what you've celled that logger
.
Cheers, Martijn,
Twitter
.
bryan lim
Ranch Hand
Posts: 140
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
thank you for you reply.
below is my edited properties. but it still don work.
log4j.rootLogger=debug, stdout, R log4j.logger.AppLogging=info, X log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout # Pattern to output the caller's file name and line number. log4j.appender.stdout.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=./logs/newsmachine.log log4j.appender.R.MaxFileSize=1000KB log4j.appender.X.File=./logs/email.log log4j.appender.X.MaxFileSize=1000KB # Keep one backup file log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n #%p %t %c - %m%n log4j.appender.X.MaxBackupIndex=1 log4j.appender.X.layout=org.apache.log4j.PatternLayout log4j.appender.X.layout.ConversionPattern=%p %t %c - %m%n
my code:
static Logger logger1 = Logger.getLogger("AppLogging"); logger1.info("testing log4j multiple appenders");
/regards
bryan
Martijn Verburg
author
Posts: 3285
13
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What exactly is failing and/or what is working?
Cheers, Martijn,
Twitter
.
What a show! What atmosphere! What fun! What a tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
how to disable the log
log to differnt files
Can't able to write errors/exception in file using log4j
Multiple log files with log4j
Log file not being created or appended to with log4j
More...