Log4jConfigListener用于Spring MVC应用程序中的登录 [英] Log4jConfigListener for logback in Spring MVC application

查看:224
本文介绍了Log4jConfigListener用于Spring MVC应用程序中的登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于Spring MVC的Web应用程序中从log4j迁移到logback.当前,在web.xml中配置Spring的Log4jConfigListener来定位log4j.xml文件,如下所示:

I am migrating from log4j to logback in my Spring MVC based web application. Currently, Spring's Log4jConfigListener is configure in web.xml to locate log4j.xml file as shown below:

<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>WEB-INF/spring/log4j.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

现在,我已经在WEB-INF/spring文件夹下创建了logback.xml文件.在web.xml中是否也有用于登录的类似配置?

Now, I have created logback.xml file under WEB-INF/spring folder. Is there a similar configuration in web.xml for logback also?

在Spring 3.1的org.springframework.web.util包中找不到任何LogbackConfigListener类

I don't find any LogbackConfigListener class in org.springframework.web.util package of Spring 3.1

推荐答案

从Spring 3.1.x开始,无法使用监听器通过Spring配置Logback.

As of Spring 3.1.x there is no way of configuring Logback with Spring using listeners.

此博客提到某人

This blog mentions that someone has sended the petition to mailing list though.

无论如何,qos-ch(莱斯·哈兹伍德)为这种情况创建了一个工件(弹簧扩展).检查

Anyways, qos-ch (Les Hazlewood) has created an artifact (spring extension) for such case. Check the github repo.

这篇关于Log4jConfigListener用于Spring MVC应用程序中的登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆