Is it possible to dynamically log the project name using property (like ${project.name} in the appender below)? I'm using log4j.xml configuration file.
If yes, where can I define such a property?
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[${project.name}] %d{ISO8601} [%t] %-5p ..%c{3}.%M(%L) - %m%n" />
</layout>
</appender>
By doing this, I'll be able to use the same log4j.xml in all my project.
One way to achieve this would be to build all your projects with Maven and use resource filtering.
(of course Ant can do this as well and probably any other build system as well, but in Maven it's a standard mechanism that is well-known)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With