ACS-3160 Replace Reload4j with Log4j2 (#1204)

* [ACS-3160] replace reload4j with log4j2

* [ACS-3160] refactor log4j version in pom.xml files

* ACS-3160 Add log4j2.properties file

* [ACS-3160] convert log4jHierarchyInit properties

* ACS-3222 Generate log4j2 rolling file in the Tomcat logs directory

* ACS-3160 Fix reconfiguration in Log4JHierarchyInit

* [ACS-3160] change loggers from log4j2 to slf4j (where possible)

* ACS-3160 Load a set of augmenting/overriding log4j2.properties files

* ACS-3160 Fix CheckRequiredClassesForLoggingConsoleUnitTest (adjust to log4j2)

* ACS-3160 Enable CheckRequiredClassesForLoggingConsoleUnitTest

* [ACS-3160] add appender util class

* [ACS-3160] fix removeAbstractAppenderFromLogger

* ACS-3160 Upgrade Log4j2 and Slf4j2 versions to the latest

* ACS-3160 Temporarily remove AOS for test purposes [tas][db]

* [ACS-3160] remove setting level from removeAbstractAppenderFromLogger

* ACS-3160 Remove references to SanitizingPatternLayout [tas]

* ACS-3892 Migrate ags-community-repo AMP to Log4j2

* ACS-3892 Reduce log4j-core scope to test

* ACS-3160 Update the aos-module version to 1.5.0-DEV-LOG4J2 [tas][db]

* [ACS-3924] upgrade greenmail version

* [ACS-3924] remove exclusion from greenmail

* ACS-3160 Fix NDC

* ACS-3160 Revert the NDC_REF

* ACS-3160 Test with googledrive with Log4j2

* ACS-3160 Log4j references cleanup

Co-authored-by: Domenico Sibilio <domenicosibilio@gmail.com>
Co-authored-by: Damian.Ujma@hyland.com <Damian.Ujma@hyland.com>
This commit is contained in:
Aleksandra Onych
2022-12-05 15:07:50 +01:00
committed by GitHub
parent 728e305a93
commit b9ccd79a73
31 changed files with 976 additions and 524 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2022 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory;
/**
* A stand in for the org.apache.log4j.NDC class that avoids introducing runtime dependencies against the otherwise
* A stand in for the org.apache.logging.log4j.ThreadContext class that avoids introducing runtime dependencies against the otherwise
* optional log4j.
*
* @author dward
@@ -32,7 +32,7 @@ public class NDC
{
private static Log logger = LogFactory.getLog(NDC.class);
/** Log4J delegate for NDC */
/** Log4J2 delegate for NDC */
private static NDCDelegate ndcDelegate;
static

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2022 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -25,19 +25,19 @@
package org.alfresco.util.log.log4j;
import org.alfresco.util.log.NDCDelegate;
import org.apache.log4j.NDC;
import org.apache.logging.log4j.ThreadContext;
/**
* A stand in for the org.apache.log4j.NDC class that avoids introducing runtime dependencies against the otherwise
* A stand in for the org.apache.logging.log4j.ThreadContext class that avoids introducing runtime dependencies against the otherwise
* optional log4j.
*
* @author dward
*/
public class Log4JNDC implements NDCDelegate
{
// Force resolution of the log4j NDC class by the classloader (thus forcing an error if unavailable)
// Force resolution of the log4j2 ThreadContext class by the classloader (thus forcing an error if unavailable)
@SuppressWarnings("unused")
private static final Class<?> NDC_REF = NDC.class;
private static final Class<?> NDC_REF = ThreadContext.class;
/**
* Push new diagnostic context information for the current thread.
@@ -47,7 +47,7 @@ public class Log4JNDC implements NDCDelegate
*/
public void push(String message)
{
NDC.push(message);
ThreadContext.push(message);
}
/**
@@ -55,6 +55,6 @@ public class Log4JNDC implements NDCDelegate
*/
public void remove()
{
NDC.remove();
ThreadContext.clearAll();
}
}