[ 
https://issues.apache.org/jira/browse/LOG4J2-2830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17169691#comment-17169691
 ] 

Axieum commented on LOG4J2-2830:
--------------------------------

Hi Ralph,

I am developing a Java add-on (my project) to a Java program (their project) 
which utilises Log4J for its logging. In my project, I can create a new Log4j 
Logger instance and logging to it logs to "their project"'s configuration and 
hence log files. This is great.

Now, my project uses a dependency 
[DV8FromTheWorld/JDA|[https://github.com/DV8FromTheWorld/JDA#logging-framework---slf4j]]
 which uses SLF4j for its logging. Hence, I add the 
`org.apache.logging.log4j:log4j-slf4j18-impl` dependency, which allows the 
dependency to log its messages to "their project"'s configuration and hence log 
files. However, I would rather like to redirect these (JDA) log messages to my 
own `log4j.xml` configuration so I can separate its logs from "their project" 
logs.

Hopefully this diagram may help visualise the problem space
:  !Untitled Diagram.jpg!

> How to merge an additional `log4j.xml` file post-initialisation?
> ----------------------------------------------------------------
>
>                 Key: LOG4J2-2830
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2830
>             Project: Log4j 2
>          Issue Type: Question
>          Components: API, Configuration, Configurators
>    Affects Versions: 2.13.2
>         Environment: * Java 1.8
>  * Log4j2 2.13.2
>  * Gradle 6.3
>            Reporter: Axieum
>            Priority: Major
>              Labels: newbie
>         Attachments: Untitled Diagram.jpg
>
>
> I am creating an add-on for a framework which, by the time my add-on begins 
> to load, has already established and loaded its own `log4j.xml` file. I would 
> like to have my `log4j.xml` file merged and loaded.
>  
> I am able to manually achieve this by, in development, modifying the run 
> configuration to include my `log4j.xml` path in the 
> `-log4j.configurationFile=their_file.xml,my_file.xml`. But this is not a 
> solution.
>  
> I cannot find a way to have my add-on run some static code before the 
> framework.
> Is it possible for the framework to remove their hardcoded configuration 
> path, and allow Log4j2 to automatically search and find all `log4j.xml` files 
> on the class path?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to