Revision 61847
Added by Claudio Atzori over 2 years ago
modules/cnr-log4j-management/trunk/pom.xml | ||
---|---|---|
3 | 3 |
<parent> |
4 | 4 |
<groupId>eu.dnetlib</groupId> |
5 | 5 |
<artifactId>dnet45-parent</artifactId> |
6 |
<version>1.0.0</version> |
|
6 |
<version>1.0.0-SNAPSHOT</version>
|
|
7 | 7 |
</parent> |
8 | 8 |
<modelVersion>4.0.0</modelVersion> |
9 | 9 |
<groupId>eu.dnetlib</groupId> |
... | ... | |
15 | 15 |
</scm> |
16 | 16 |
<dependencies> |
17 | 17 |
<dependency> |
18 |
<groupId>log4j</groupId> |
|
18 |
<groupId>org.apache.logging.log4j</groupId>
|
|
19 | 19 |
<artifactId>log4j</artifactId> |
20 | 20 |
<version>${log4j.version}</version> |
21 |
<type>pom</type> |
|
21 | 22 |
</dependency> |
22 | 23 |
<dependency> |
23 | 24 |
<groupId>org.springframework</groupId> |
modules/cnr-log4j-management/trunk/src/main/java/eu/dnetlib/management/log4j/Log4JMBean.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.management.log4j; |
2 | 2 |
|
3 |
import org.apache.log4j.Level; |
|
4 |
import org.apache.log4j.LogManager; |
|
3 |
import java.util.logging.LogManager; |
|
5 | 4 |
|
6 | 5 |
/** |
7 | 6 |
* Exports log level control via jmx. |
... | ... | |
11 | 10 |
*/ |
12 | 11 |
public class Log4JMBean { |
13 | 12 |
public void setLogger(String category, String level) { |
14 |
LogManager.getLogger(category).setLevel(Level.toLevel(level));
|
|
13 |
LogManager.getLoggingMXBean().setLoggerLevel(category, level);
|
|
15 | 14 |
} |
16 | 15 |
} |
Also available in: Unified diff
updating to log4j 2.15.0 - Log4Shell CVE-2021-44228