[logback-user] where is ${webapp.root}
Simon Wong
simonwg at gmail.com
Fri Nov 27 08:58:20 UTC 2015
Hi,
logback-ext-spring is what you need.
I am using Spring MVC JavaConfig
public class MvcWebApplicationInitializer extends
AbstractAnnotationConfigDispatcherServletInitializer {
// other Spring JavaConfig
@Override
public void onStartup(ServletContext servletContext) throws
ServletException {
servletContext.setInitParameter("webAppRootKey", "*my.app.root*");
servletContext.setInitParameter("logbackConfigLocation",
"/META-INF/logback.xml");
servletContext.addListener(LogbackConfigListener.class);
super.onStartup(servletContext);
}
}
In logback.xml
<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="3 seconds">
<property resource="logback.properties" />
<variable name="FILE_NAME_PREFIX" value="myLogPrefix" />
<variable name="APPLICATION_ROOT" value="*${my.app.root}*" />
<variable name="LOG_PATTERN" value="%d{HH:mm:ss.SSS} [%thread] %-5level
%logger{32} - %msg%n" />
<variable name="LOG_MAX_HISTORY" value="${logs.max.history.in.days}" />
<variable name="LOG_OUTPUT_FORMAT" value="${logs.output.format}" />
<!-- Other logback appender config here.... -->
On Fri, Nov 27, 2015 at 2:57 PM, Miloslava Teneva <miloslava at gmail.com>
wrote:
> Hi All,
> we switched to logback from log4j.And everything was fine until we notice
> that parameter ${webapp.root} that we used with log4j, now is not
> recognize.We really need this because our logs are under our webapp dir.We
> use tomcat and we want our logs not to be in tomcat/bin directory.We even
> try logback-ext-spring.jar but without success.We really need your help and
> ideas.We don`t want to put relative paths.We want webapp.root to be taken
> dynamically.
>
> Thanks for your help.
> Have a nice day,
> Miloslava
>
> _______________________________________________
> logback-user mailing list
> logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20151127/6dab5707/attachment.html>
More information about the logback-user
mailing list