Log4j Dependecy Project NOT READING Properties File

68
September 16, 2021, at 09:50 AM

So I have a main spring-boot project that has 2 other projects (not spring) as dependency.

All these 3 project's have LOG4J implemented with a log4j.properties file on the resources file. They also have these dependencies on the pom.xml:

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.14.0</version>
</dependency>
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.14.0</version>
</dependency>

But for some reason, only the logs on the main project seem to read the properties file, because of the layout configuration that I defined.

Main project properties file:

log4j.logger.com.example.MainProject=DEBUG, consoleAppender, FILE
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.consoleAppender.layout.ConversionPattern=[MainProject] - %-5p - %d{yyyy-MM-dd HH:mm:ss.SSS} - %C:%M:%L - %m%n
## File Appender
log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FILE.File=/opt/app/log/MainProject.log
log4j.appender.FILE.DatePattern='_'yyyy-MM-dd
log4j.appender.FILE.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.FILE.layout.ConversionPattern=[MainProject] - %-5p - %d{yyyy-MM-dd HH:mm:ss.SSS} - %C:%M:%L - %m%n
log4j.additivity.com.example.MainProject=false

Project B properties file:

log4j.logger.com.example.ProjectB=DEBUG, stdout, consoleAppender
# Redirect log messages to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[ProjectB] - %-5p - %d{yyyy-MM-dd HH:mm:ss.SSS} - %C:%M:%L - %m%n
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.consoleAppender.layout.ConversionPattern=[ProjectB] - %-5p - %d{yyyy-MM-dd HH:mm:ss.SSS} - %C:%M:%L - %m%n

The other project its exactly the same has the example of ProjectB

On the logs, I can confirm that the logs inside of the Main Project are printed with the right layout:

[MainProject] - DEBUG - 2021-09-15 13:37:51.157 - com.example.MainProject.MainProjecApplication:start:35 - Starting Server...
[MainProject] - INFO  - 2021-09-15 13:37:52.241 - com.example.MainProject.MainProjecApplication:start:46 - Server Running!

But on the logs inside of the Project B that is a dependency of the Main Project, they wont print with the right layout. Instead they are printed like this:

0 [main] INFO com.example.ProjectB.Stan  - Connecting to NATS Server...
181 [main] INFO com.example.ProjectB.Stan  - Connected to NATS SUCCESSFULLY.

That said, it seems to me that the dependecy projects are not reading their own log4j properties file. I've searched but I can't find a solution to this problem...

Thank you all in advance! :)

READ ALSO
Uncaught ReferenceError: addAdresar is not defined at HTMLInputElement.onclick

Uncaught ReferenceError: addAdresar is not defined at HTMLInputElement.onclick

I created a modal popup with grid columnsThis works well, my data is loaded into the grid

45
python extract entries from a list based from keywords in a dictionary

python extract entries from a list based from keywords in a dictionary

I'm trying to filter laptop entries only from a list (productUrltxt) and save it in a seperate text file (laptop

70
Difference of exception and unfulfilled promise?

Difference of exception and unfulfilled promise?

I am reading about error handling, and the book says

48
Error - [webpack] &#39;dist&#39;: list-documents-web-part.js from UglifyJs Unexpected token: name (style) [list-documents-web-part.js:73666,7]

Error - [webpack] 'dist': list-documents-web-part.js from UglifyJs Unexpected token: name (style) [list-documents-web-part.js:73666,7]

I have an application in SPFXAfter installing and started to use a jQuery Datatable component, I get the following error on gulp bundle:

76