SK-Yang commented on issue #1269:
URL: 
https://github.com/apache/logging-log4j2/issues/1269#issuecomment-1427530083

   @ppkarwasz 
   > @SK-Yang,
   > 
   > Messages prefixed by `log4j:` were used by the unsupported Log4j 1.2. Make 
sure that:
   > 
   >     * You **don't** have 
[`log4j:log4j`](https://mvnrepository.com/artifact/log4j/log4j) on your 
classpath,
    
   I have checked its lib folder, POM, and IDE build path, no old Log4j 1.2 
included.
   
   >     * You have 
[`org.apache.logging:log4j-1.2-api`](https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-1.2-api)
 on your classpath,
   
   log4j-1.2-api-2.19.0.jar, log4j-api-2.19.0.jar, log4j-core-2.19.0.jar. just 
them.
    
   >     * Either the system property `log4j1.compatibility=true` is set or 
`log4j.configuration` points to your `log4j.properties` file.
   
   doesn't have any system prop setting inside my program, but I do have a 
simple mechanism to read my properties file.
   
   ```
   public class Log4j {
   
        public final static Logger LOG = Logger.getLogger(Log4j.class);
        private static boolean configurated = false;
   
        public Log4j() {
        };
   
        public Log4j(String config_path) {
                if (configurated == false) {
                        Properties p = new Properties();
   
                        try {
                                p.load(new FileInputStream(config_path));
                                PropertyConfigurator.configure(p);
                                configurated = true;
                        } catch (IOException e) {
                                System.out.println("[Error] Unable to read 
log4j config: " + e.getMessage());
                        } finally {
                                if (p != null) {
                                        p.clear();
                                }
                        }
                }
        };
   }
   ```
   This works fine since 1.12.x to 2.17.0 over the past few years. I still 
cannot understand why it won't on 2.19.0.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to