New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support log4j2 with yaml format #2239

Closed
anibalgomezprojects opened this Issue Dec 27, 2014 · 4 comments

Comments

Projects
None yet
5 participants
@anibalgomezprojects

anibalgomezprojects commented Dec 27, 2014

Log4j2 is supporting log4j2.yml and yaml and spring boot log4j2 is not, any solution?

https://issues.apache.org/jira/browse/LOG4J2-427

Regards!

Automatic Configuration
Log4j has the ability to automatically configure itself during initialization. When Log4j starts it will locate all the ConfigurationFactory plugins and arrange then in weighted order from highest to lowest. As delivered, Log4j contains three ConfigurationFactory implementations: one for JSON, one for YAML, and one for XML.

Log4j will inspect the "log4j.configurationFile" system property and, if set, will attempt to load the configuration using the ConfigurationFactory that matches the file extension.
If no system property is set the YAML ConfigurationFactory will look for log4j2-test.yaml or log4j2-test.yml in the classpath.
If no such file is found the JSON ConfigurationFactory will look for log4j2-test.json or log4j2-test.jsn in the classpath.
If no such file is found the XML ConfigurationFactory will look for log4j2-test.xml in the classpath.
If a test file cannot be located the YAML ConfigurationFactory will look for log4j2.yaml or log4j2.yml on the classpath.
If a YAML file cannot be located the JSON ConfigurationFactory will look for log4j2.json or log4j2.jsn on the classpath.
If a JSON file cannot be located the XML ConfigurationFactory will try to locate log4j2.xml on the classpath.
If no configuration file could be located the DefaultConfiguration will be used. This will cause logging output to go to the console.

@snicoll snicoll changed the title from File not found log4j2.yml to Support log4j yaml format Dec 27, 2014

@philwebb philwebb changed the title from Support log4j yaml format to Support log4j2 with yaml format Dec 28, 2014

@philwebb philwebb added this to the 1.2.2 milestone Dec 28, 2014

@wilkinsona

This comment has been minimized.

Show comment
Hide comment
@wilkinsona

wilkinsona Jan 8, 2015

Member

Log4J 2's YAML processing uses Jackson's YAML support, whereas Spring Boot uses SnakeYAML. It's easy to fix this if we're happy to require a jackson-dataformat-yaml dependency. It's harder, but still possible, if we want to allow SnakeYAML to be used - we'd have to write our own ConfigurationFactory for YAML that uses SnakeYAML.

@philwebb Do you have a preference?

Member

wilkinsona commented Jan 8, 2015

Log4J 2's YAML processing uses Jackson's YAML support, whereas Spring Boot uses SnakeYAML. It's easy to fix this if we're happy to require a jackson-dataformat-yaml dependency. It's harder, but still possible, if we want to allow SnakeYAML to be used - we'd have to write our own ConfigurationFactory for YAML that uses SnakeYAML.

@philwebb Do you have a preference?

@philwebb

This comment has been minimized.

Show comment
Hide comment
@philwebb

philwebb Jan 8, 2015

Member

I don't think we should write our own. Perhaps optional jackson-dataformat-yaml support?

Member

philwebb commented Jan 8, 2015

I don't think we should write our own. Perhaps optional jackson-dataformat-yaml support?

@philwebb

This comment has been minimized.

Show comment
Hide comment
@philwebb

philwebb Jan 8, 2015

Member

We should push this back to 1.3 if it's risky or complicated.

Member

philwebb commented Jan 8, 2015

We should push this back to 1.3 if it's risky or complicated.

@cemo

This comment has been minimized.

Show comment
Hide comment
@cemo

cemo Jan 9, 2015

Contributor

Latest Jackson improvements is awesome and definitely +1 for jackson-dataformat-yaml. FWIW Jackson is also using SnakeYAML and shading it.

Contributor

cemo commented Jan 9, 2015

Latest Jackson improvements is awesome and definitely +1 for jackson-dataformat-yaml. FWIW Jackson is also using SnakeYAML and shading it.

@wilkinsona wilkinsona self-assigned this Jan 22, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment