|
From: Daniel P. <dan...@gm...> - 2007-10-16 10:07:26
|
Hello everybody!
First, sorry for my poor english.
I'm a newbie in jetty. I'm using embedded jetty6. Since days I try to
controll the jetty produced loggs.
That's how i'm using embedded jetty:
------------------------------------------------------------------------
----------------------------------
System.setProperty( "org.mortbay.log.class",
"de.poodratchi.surveyModule.JettyToGcLog");
server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort( port.intValue());
connector.setHost( "127.0.0.1");
server.addConnector(connector);
WebAppContext wac = new WebAppContext();
wac.setContextPath( "/");
wac.setWar( "myWebApp.war");
server.setHandler( wac);
server.setStopAtShutdown( true);
try {
server.start();
if ( debug) log.out( null, SurveyModuleImpl.class,
"JettyServer START OK");
} catch ( Exception e) {
e.printStackTrace();
log.out( null, SurveyModuleImpl.class, "JettyServer START
FAILED" + e);
}
------------------------------------------------------------------------
----------------------------------
So far, I think I'm able to controll the jetty Implementaion loggs
with these lines of code:
------------------------------------------------------------------------
----------------------------------
System.setProperty( "org.mortbay.log.class",
"myPackage.myLogAdapterClass");
------------------------------------------------------------------------
----------------------------------
So, "myPackage.myAdpaterClass" implements org.mortbay.log.Logger to
forward all logging to my own Logging Implementaion.
Are there better ways to controll the jetty implementaion logs?
My second Problem is to generate loggs in my servlets and JSPs in the
webApp. What do you think is a good way to generate logs in a servlet?
I read about logging via "getServletContext().log....". But where are
the logs outputed when i use this? Is there any better way to log in
servlets? (There are only 3 methods to log via servletContext). The
essential question is how to adapt the servlet generated logs to my
own logging implementation....
Really hope you can help me...
Thank you very much!
|