-
1. Re: Custom Logging in Seam
gavin.king Jul 26, 2007 1:55 PM (in response to ucfjeff)No, not at present (the reason for this is that we use Logging outside of Seam contexts, so I can't make Logging a Seam component).
Why do you want to do that? -
2. Re: Custom Logging in Seam
matt.drees Jul 26, 2007 2:13 PM (in response to ucfjeff)I'm fairly sure you can't. Not without patching Seam.
-
3. Re: Custom Logging in Seam
matt.drees Jul 26, 2007 2:13 PM (in response to ucfjeff)oops, didn't see Gavin's reply. My bad.
-
4. Re: Custom Logging in Seam
ucfjeff Jul 26, 2007 2:36 PM (in response to ucfjeff)We have a custom log implementation that wraps log4j. It collects extra application (appID, serverName, etc) and session data (sessionID, customerID, etc) for analysis while staying as close to the log4j style as possible.
For convienence and standardization we wanted to use the @Logger annotation in our new Seam apps.
I suppose we can inject our logger as a Seam class, but we will lose the ability to use EL expressions in our log Strings.
Perhaps we can come up with a clever way to use Seam logging and collect said data. -
5. Re: Custom Logging in Seam
matt.drees Jul 26, 2007 3:47 PM (in response to ucfjeff)Here's an idea.
I'm not a log4j guru, but it looks like you can specify a LoggerFactory in your log4j config file. So, maybe you can adapt/wrap your custom log impl as a log4j Logger, and make a LoggerFactory that produces those instead of the vanilla Logger objects.
So, solve the problem completely above Seam. -
6. Re: Custom Logging in Seam
matt.drees Jul 26, 2007 4:13 PM (in response to ucfjeff)Here's another (probably bad) idea.
Create a Seam interceptor that looks for a @Logger field and replaces the default Log instance with yours.
Of course, your stack traces are that much bigger and maybe method calls are a tiny bit slower, and I think you might have to annotate all of your classes. But maybe there are ways around that. -
7. Re: Custom Logging in Seam
matt.drees Jul 26, 2007 4:18 PM (in response to ucfjeff)At first I was thinking that you could create an observer for "org.jboss.seam.postCreate.*", but then I found out events don't handle wildcards.
Gavin, if you're still following this thread, are wildcard events a bad idea? I kinda like the thought... -
8. Re: Custom Logging in Seam
gavin.king Jul 26, 2007 5:11 PM (in response to ucfjeff)"ucfjeff" wrote:
We have a custom log implementation that wraps log4j. It collects extra application (appID, serverName, etc) and session data (sessionID, customerID, etc) for analysis while staying as close to the log4j style as possible.
Why not just use the log4j NDC for this?
Here's an example from Seam CVS:
http://fisheye.jboss.com/browse/JBoss/jboss-seam/src/main/org/jboss/seam/web/LoggingFilter.java?r=1.2 -
9. Re: Custom Logging in Seam
gavin.king Jul 26, 2007 5:12 PM (in response to ucfjeff)"matt.drees" wrote:
At first I was thinking that you could create an observer for "org.jboss.seam.postCreate.*", but then I found out events don't handle wildcards.
Gavin, if you're still following this thread, are wildcard events a bad idea? I kinda like the thought...
Hum, I guess it could be interesting, but I want to see a truly compelling usecase first. (This is not one.) -
10. Re: Custom Logging in Seam
gavin.king Jul 26, 2007 5:16 PM (in response to ucfjeff)"matt.drees" wrote:
Here's another (probably bad) idea.
Create a Seam interceptor that looks for a @Logger field and replaces the default Log instance with yours.
Of course, your stack traces are that much bigger and maybe method calls are a tiny bit slower, and I think you might have to annotate all of your classes. But maybe there are ways around that.
Yes, this is possible using an @PostConstruct interceptor.
Someday we really need to get around to allowing interceptors to be declared in components.xml, to save the need for an annotation. -
11. Re: Custom Logging in Seam
ucfjeff Jul 27, 2007 2:07 PM (in response to ucfjeff)Thank you Matt and Gavin.
We have found that the log4j MDC will meet our requirements in the manner of the example provided by Gavin above.
Matt you are here in Orlando? -
12. Re: Custom Logging in Seam
matt.drees Jul 27, 2007 2:42 PM (in response to ucfjeff)I am indeed. I take it you're at UCF?
-
13. Re: Custom Logging in Seam
ucfjeff Jul 27, 2007 3:25 PM (in response to ucfjeff)A long time ago. Local major corporation.
-
14. Re: Custom Logging in Seam
matt.drees Jul 28, 2007 2:40 PM (in response to ucfjeff)Cool. I may be looking for a job soon in the area, and it'd be great to be doing development in Seam. Could you email me at matt.drees at gmail dot com if there are any openings at your company? Thanks!