-
1. Re: Better log handling during seam startup ?
pmuir Mar 25, 2008 11:10 AM (in response to gonzalad)Don't really understand your request.
In the code you quote Seam is logging to either JDK logging or Log4j depending on which is installed.
It's up to the logging provider/the app server to do any further work like splitting it out into application specific log files.
-
2. Re: Better log handling during seam startup ?
gonzalad Apr 9, 2008 11:09 AM (in response to gonzalad)Really sorry, I didn't see your answer before.
In fact, my problem is that Seam does not log errors on startup.
Here's SeamListener 2.0.0.GA code :
public void contextInitialized(ServletContextEvent event) { log.info( "Welcome to Seam " + Seam.getVersion() ); ServletLifecycle.beginApplication( event.getServletContext() ); new Initialization( event.getServletContext() ).create().init(); }
Would it be possible to modify SeamListener on order to do some error logging ? (like in the sample code I wrote in my first post).
-
3. Re: Better log handling during seam startup ?
pmuir Apr 10, 2008 11:47 AM (in response to gonzalad)I still don't understand what you mean? Any exceptions thrown by Seam at deployment will propagate up and the container will log them (thats the case in all the containers I've worked with - JBoss, Tomcat, Glassfish, WLS, WAS, OC4J).
Log and rethrow is a particularly evil pattern as you end up with multiple points logging the same error - totally unnecessary if you have a well behaved container and logger.
-
4. Re: Better log handling during seam startup ?
gonzalad Apr 10, 2008 2:52 PM (in response to gonzalad)
Log and rethrow is a particularly evil patternI see your point.
I use Websphere. As you said, Websphere logs this kind of errors in stdout.
My problem is more related to production habits in my company.
One vm hosts more or less 5 applications. There's more than 50 vm in production.If we only rely on app server logging, each logging statement will be output to the same file (appserver's stdout), let's say
/etc/websphere/logs/server1/SystemOut.log.It's really easier to have a specific file for each app.
In order to do this, we usually parameter log4j in each application (having a custom log4j.xml in each application) to log to an application specific output directory.
For instance :
/etc/logs/sample-ear/sample.log (output from sample.ear)
/etc/logs/hello-ear/hello.log (output from hello.ear)So, when we'll have 5 Seam powered apps per vm, we'll end up with the initialization errors of the 5 applications in the same log file (we cannot setup websphere to log in a different file for each application).
It will be harder to dissociate logging output from application 1 from logging output from application 2.
-
5. Re: Better log handling during seam startup ?
pmuir Apr 13, 2008 6:17 PM (in response to gonzalad)I see your point, but this seems more of a websphere problem than a Seam problem - that WAS logs to STDOUT is very nasty!
The trouble with not propagating the exception (which is the other option) is that then the deployment won't fail.
Anyway, add this to platform interop in JIRA, and I'll consider options.
-
6. Re: Better log handling during seam startup ?
gonzalad Apr 14, 2008 12:59 PM (in response to gonzalad)