I implemented my own Maven plugin mojo in which I used log4j + slf4j. In the plugin project I have included the correct jars and can see correct logging of statements from code.
Now I want use this new maven plugin in another client project but having trouble getting it to work correctly.
In the plugin itself I have included a log4j.properties under src/main/resources which works fine as mentioned above. But when I try to include the plugin in another client project the log file is not being created.
The question is what else do I have to try or do to get this working correctly? Thank you.
You must not put log4j.properties
into src/main/resources
.
Log4j will look just for a single log4j.properties
resource on the classpath, so depending on the order of elements on the classpath, either your code or the other project will win.
You can put this resource on the test classpath so your tests work correctly.
For the final application, you must load the file from somewhere else or create a kind of "application" Maven project which just contains dependencies, the code of main()
, and config files.