I am trying to use the default active web library to log everything to a separate log file. Right now I'm running everything under IntelliJ (via mvn jetty:run) and all the logging is coming out to the console only.
I tried added a log4j.properties file in the WEB-INF directory; didn't work (I have not added log4j dependency to my pom as I don't want it in there).
Looking a slf4j, I cannot find any properties or config file that let's me define how I would log to a specific log file. And, I'm not sure what logging AW uses, so it's hard to see what I need to configure.
Stuck at this point, and just googling and reading thru the slf4j site to try to get this working.
I general, if you want logging done by Log4j and Slf4j, you will need to add appropriate dependencies. Here is the configuration from one of our projects:
this will bring appropriate deps.
Here is the contents of the
log4j.properties
file.The
logger-name
is a Maven- filtered property. Locally it is resolved toCONSOLE
and when the app is built, it resolves toFILE
. This way, we can observe log on the console during development.The class
SplunkLogFilter
looks like this:So, we are logging into two files in parallel, where one is shipped into Splunk. The Splunk file is smaller, so we pay less for Splunk, but we retain full files just in case.