I'm using Struts 2.0.11.2 and I don't what was changed recently in my app that I get TONS of freemarker logs:
DEBUG 13201 [freemark] (): template/simple/hidden.ftl[en,UTF-8,parsed] cached copy not yet stale; using cached.
How can I turn off these annoying logs? I know of the freemarker.properties file but I don't find how to specify log levels from there. I tried the hack in my code:
freemarker.log.Logger.selectLoggerLibrary(freemarker.log.Logger.LIBRARY_NONE);
and for some people it doesn't work. I'm not using log4j, just standard java logging.
By the way: I'm not planning to change the Struts version or the logging framework.
If you are on Weblogic you can disable the debug messages with a LogFilter as described here: http://blog.technogemsinc.com/2012/09/weblogic-disabling-freemark-debug.html.
Look where you configure java.util.logging (or commons logging maybe). If the logger says that it logs debug-level messages from FreeMaker, FreeMarker will send debug-level messages. This is just like with any other library.
Disabling FreeMarker logging is certainly not a good idea, as you want to see the warnings and errors. (The reasons LIBRARY_NONE
doesn't work is certainly that you call it too late, when some messages was already logged, and thus FreeMarker logging was already initialized.)
来源:https://stackoverflow.com/questions/7971421/disable-freemarker-logs