You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Johan Gunnarsson <jo...@init.se> on 2012/11/21 17:48:03 UTC

"tagging" log messages

Is there some way to "tag" log messages in log4j.properties depending on
different criteria?

Today I am splitting up the files like this:

log4j.category.foo.bar=WARN, ALOG, CATCHALL
log4j.category.foo.bar.mvc.dao.core.EscenicFieldsImpl=ERROR, ALOG, CATCHALL
log4j.category.foo.bar.mvc.dao.content.TitelSidaDAOImpl=ERROR, ALOG,
CATCHALL
log4j.category.foo.bar.mvc.controller.BroadcastBoxController=ERROR, ALOG,
CATCHALL
log4j.category.foo.bar.spring.config.LoggingPropertyPlaceholderConfigurer=INFO,
ALOG, CATCHALL

log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]=
WARN, BLOG, CATCHALL
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo]=
WARN, FOOLOG, CATCHALL
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/bar]=
WARN, BARLOG, CATCHALL

ALOG, BLOG, FOOLOG and BARLOG all goes to different appenders, and CATCHALL
is exactly what it sounds like.


Instead of this i want all entrys to end up in only one file and have some
kind of tag (like [FOOLOG]) on the entrys that previously ended up in the
file defined in the FOOLOG appender.



--
Johan Gunnarsson

Re: "tagging" log messages

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Johan,

On 11/21/12 11:48 AM, Johan Gunnarsson wrote:
> Is there some way to "tag" log messages in log4j.properties
> depending on different criteria?

If you are definitely going to be using log4j, try reading about
"Nested Diagnostic Contexts".

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlCvweEACgkQ9CaO5/Lv0PDpZQCeKHbVRkUg+gegqrI4Hc36IJ/9
q44An3lkxj3xWZ3tAvI97j+R4A5QXxjf
=gRet
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: "tagging" log messages

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/11/21 Johan Gunnarsson <jo...@init.se>:
> Is there some way to "tag" log messages in log4j.properties depending on
> different criteria?
>
> Today I am splitting up the files like this:
>
> log4j.category.foo.bar=WARN, ALOG, CATCHALL
> log4j.category.foo.bar.mvc.dao.core.EscenicFieldsImpl=ERROR, ALOG, CATCHALL
> log4j.category.foo.bar.mvc.dao.content.TitelSidaDAOImpl=ERROR, ALOG,
> CATCHALL
> log4j.category.foo.bar.mvc.controller.BroadcastBoxController=ERROR, ALOG,
> CATCHALL
> log4j.category.foo.bar.spring.config.LoggingPropertyPlaceholderConfigurer=INFO,
> ALOG, CATCHALL
>
> log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]=
> WARN, BLOG, CATCHALL
> log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo]=
> WARN, FOOLOG, CATCHALL
> log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/bar]=
> WARN, BARLOG, CATCHALL
>
> ALOG, BLOG, FOOLOG and BARLOG all goes to different appenders, and CATCHALL
> is exactly what it sounds like.
>
>
> Instead of this i want all entrys to end up in only one file and have some
> kind of tag (like [FOOLOG]) on the entrys that previously ended up in the
> file defined in the FOOLOG appender.
>

This is Tomcat users list.  The Log4J users mailing list is elsewhere
- you should better ask there:

http://logging.apache.org/log4j/1.2/mail-lists.html
http://logging.apache.org/log4j/2.x/mail-lists.html

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org