I want to log all server related logs (like startup and shutdown) to one file and all Hibernate SQL related logs to a different file using Log4J. I am trying to filter all irrelevant logs to see just the SQL queries. Any idea or suggestions if there is a way we can achieve it?
Thanks.
You can do that if you use two different appenders, as is shown in the following configuration file (XML): 1
Using categories (
category
), you can easily configure the appender destination (appender-ref
) and if you want to log in the default appenders (additivity="false"
).Notes
log4j.xml
file automatically in the classpath of the application (the default package orresources
directory)