Logging from Wicket alone and together with Spring and Hibernate + my own code

2009-01-20 Thread Kent Larsson
Hi, I have some questions about logging, more specifically about setting it
up and making sure it works.

The project I'm doing will use Wicket, Spring and Hibernate. I know that
Wicket and Hibernate uses Simple Logging Facade for Java (SL4J) and that
Spring is using the logging component from Apache Commons.

Will they co-exist happily?
I thought I would use log4j together with both SL4J and the logging
component from Apache commons, do you think that's a good idea?

Can I set up them all to output logging data into a common file?
Or should I use separate files?
Or should I store the logging messages in the database? (I'd rather not, as
I find grepping etc on text files quite convenient.)

Not strictly Wicket, but for Spring I guess I need some kind of
configuration file for the Apache Commons logging component as well where I
direct it to use log4j?

When I've set these up I guess to see that everything works I set the
logging level to INFO as it's fairly certain that all three of the
frameworks output some information in that mode? Or is there an even better
way to make sure?

And my last question. In the project I'm starting, do you recommend that I
use SL4J for my own logging purposes? (I thought I would use log4j directly,
but that was before I learned a little bit more about logging and a lot of
respectable libraries seem to choose the path of a bridge/facade for their
logging needs. And if it gets us flexibility without added cost there's no
reason not to do it that way.)

I'm looking forward to hearing more from you about how you are doing your
logging. It's a new area for me which I'm eager to improve myself in.

Best regards, Kent


Re: Logging from Wicket alone and together with Spring and Hibernate + my own code

2009-01-20 Thread Erik van Oosten

Hi Kent,

I am using the SLF4j implementation of commons-logging. If you use 
maven2 take a look at this blog article for an pom example that will set 
this up with log4j as logging backend: 
http://day-to-day-stuff.blogspot.com/2007/07/no-more-commons-logging.html.


Below is a more up to date pom extract that also adds a 
java.util.logging to slf4j bridge (you need to call 
SLF4JBridgeHandler.install() at some point during application init).


Regards,
   Erik.

   !-- Logging section. --
   !-- Do not use commons-loggin! --
   dependency
   groupIdcommons-logging/groupId
   artifactIdcommons-logging/artifactId
   version99.0-does-not-exist/version
   scopeprovided/scope
   /dependency
   !-- the slf4j commons-logging replacement --
   dependency
   groupIdorg.slf4j/groupId
   artifactIdjcl-over-slf4j/artifactId
   version1.5.2/version
   /dependency
   !-- direct java.util.logging to slf4j --
   dependency
   groupIdorg.slf4j/groupId
   artifactIdjul-to-slf4j/artifactId
   version1.5.2/version
   /dependency
!-- the other slf4j jars --
   dependency
   groupIdorg.slf4j/groupId
   artifactIdslf4j-api/artifactId
   version1.5.2/version
   /dependency
   !-- using log4j as backend --
   dependency
   groupIdorg.slf4j/groupId
   artifactIdslf4j-log4j12/artifactId
   version1.5.2/version
   /dependency
   dependency
   groupIdlog4j/groupId
   artifactIdlog4j/artifactId
   version1.2.14/version
   /dependency
   !-- End of logging section. --




Kent Larsson wrote

Hi, I have some questions about logging, more specifically about setting it
up and making sure it works.

The project I'm doing will use Wicket, Spring and Hibernate. I know that
Wicket and Hibernate uses Simple Logging Facade for Java (SL4J) and that
Spring is using the logging component from Apache Commons.

Will they co-exist happily?
I thought I would use log4j together with both SL4J and the logging
component from Apache commons, do you think that's a good idea?

Can I set up them all to output logging data into a common file?
Or should I use separate files?
Or should I store the logging messages in the database? (I'd rather not, as
I find grepping etc on text files quite convenient.)

Not strictly Wicket, but for Spring I guess I need some kind of
configuration file for the Apache Commons logging component as well where I
direct it to use log4j?

When I've set these up I guess to see that everything works I set the
logging level to INFO as it's fairly certain that all three of the
frameworks output some information in that mode? Or is there an even better
way to make sure?

And my last question. In the project I'm starting, do you recommend that I
use SL4J for my own logging purposes? (I thought I would use log4j directly,
but that was before I learned a little bit more about logging and a lot of
respectable libraries seem to choose the path of a bridge/facade for their
logging needs. And if it gets us flexibility without added cost there's no
reason not to do it that way.)

I'm looking forward to hearing more from you about how you are doing your
logging. It's a new area for me which I'm eager to improve myself in.

Best regards, Kent

  

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org