I want to have a log4j configuration such that the log file name should have like ${System-name}log.log. that is if the application is launched on any system then without changing the configuration file or code. it should generate the log file name as mentioned. thanks.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
I do it this way:
1) init logger by:
2) in log4j.xml i use variable:
You can use Java system properties with the
${property}
syntax. There are number of system properties that are defined by default includingFor a full list of default properties see API of System or list them with
System.getProperties().list(System.out)
.If the default properties won't do then you'll have top add your own properties using
System.setProperty(property, value)
.