Hi Gert,
maybe I misunderstood the requirement. If the user want to create its
own log file, he has to modify the org.ops4j.pax.logging.cfg file (to
add its logger/appender).
Else, if it's just to log into servicemix.log, as the rootLogger does it
already, as you said, just logging (using slf4j, commons-logging, etc)
is enough ;)
Regards
JB
On 01/24/2012 09:38 AM, Gert Vanthienen wrote:
L.S.,
You probably don't have edit this configuration file at all - if you want,
you can use it to e.g. create a separate log file for your own code or
something, but if you just want to write to servicemix.log, everything
should be good to go.
Just use any of the logging frameworks you're familiar with (slf4j, log4j,
commons-logging, ...) from within your own Java code. In ServiceMix,
logging from all these frameworks is being handled by Pax Logging, so it
will automatically end up in the servicemix.log file.
Regards,
Gert Vanthienen
------------------------
FuseSource
Web: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/
On Mon, Jan 23, 2012 at 5:57 PM, Castyn<eric.ben...@gmail.com> wrote:
Is there an example of this somewhere, I am fairly new to the majority of
this.
In the file you mentioned I see
# Root logger
log4j.rootLogger = INFO, out, osgi:VmLogAppender
log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p |
%-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} -
%X{bundle.version} | %m%n
# File appender
log4j.appender.out=org.apache.log4j.RollingFileAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p |
%-16.16t
| %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
%m%n
log4j.appender.out.file=${karaf.data}/log/servicemix.log
log4j.appender.out.append=true
log4j.appender.out.maxFileSize=100MB
log4j.appender.out.maxBackupIndex=10
# Sift appender
log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.sift.key=bundle.name
log4j.appender.sift.default=servicemix
log4j.appender.sift.appender=org.apache.log4j.FileAppender
log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
log4j.appender.sift.appender.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p
| %-16.16t | %-32.32c{1} | %m%n
log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
log4j.appender.sift.appender.append=true
log4j.logger.org.apache.camel = INFO
I'm not sure how to create one here as well as in my code to properly have
it use one of these appenders. Sorry for being a newb!
--
View this message in context:
http://camel.465427.n5.nabble.com/Writing-the-servicemix-log-within-custom-java-tp5166486p5166698.html
Sent from the Camel - Users mailing list archive at Nabble.com.
--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com