Comments (3)
@ppkarwasz I have the same problem since I upgraded from 2.17.2 to 2.19 (Spring boot 2.3.9)
I don't need two log4j files or arbiters to make it work in 2.17.2
But since 2.18 it stopped working because of the new way to load LoggingSystemFactory (spring.factories)
I still don't understand why spring.factories are not loaded
EDIT : It don't work because LoggingSystemFactory does not exist before Spring 2.4, the documentation mention that the lib require Spring boot 2.0.3 or 2.1.1, which is outdated since Log4J 2.18
from logging-log4j2.
Logging in a Spring Boot application is configured at least twice:
- when the
SpringApplication
class is loaded (that is what you see in your stacktrace). This process is described in automatic configuration and does not have access to Spring's environment (that didn't start yet), - after the
ApplicationEnvironmentPreparedEvent
is fired (cf. lifecycle of a Spring Boot application). This process is specific to Spring Boot, has access to Spring's environment and uses thelog4j2-spring.xml
file (falling back onlog4j2.xml
if such a file does not exist).
If you want to use Spring's enviroment to configure your logging system you have to options:
- Create two files:
log4j2.xml
andlog4j2-spring.xml
. The first one will be used during the bootstrap phase of your application and can not use Spring's environment. The second one will be used, when your application is up and running. - Stick to a single configuration file and use arbiters to provide multiple versions of your "solver-service" appender:
<Select>
<SpringProfile name="dev">
<File name="solver-service" fileName="${spring:log4j.solver.service.path}" append="false">
<EcsLayout serviceName="${spring:log4j.solver.service.name}" serviceVersion="${spring:log4j.solver.service.version}" serviceEnvironment="${spring:log4j.solver.service.enviroment}"/>
</File>
</SpringProfile>
<DefaultArbiter>
<Null name="solver-service"/>
</DefaultArbiter>
</Select>
from logging-log4j2.
I am closing this for lack of activity. I think that:
Fill free to reopen the issue.
from logging-log4j2.
Related Issues (20)
- Logger precision formats in PatternLayout do not match documentation
- Removing all keys from `ThreadContextMap` does not clear the `ThreadLocal`
- Revamp the `Configuration` page HOT 2
- Revamp the `Lookups` page
- Revamp the `Layouts` page
- Revamp the `Appenders` page HOT 1
- Revamp the `Filters` page
- Revamp the `Extending` page
- Revamp the `Plugins` page
- Create a `Troubleshooting` page
- Revamp the `Performance` page
- Revamp the `Asynchronous logging` page
- Revamp the `API` page
- Uniform handling of location and URIs HOT 1
- [MS14] Documentation revamp 1/5
- [MS15] Documentation revamp 2/5
- [MS16] Documentation revamp 3/5
- [MS17] Documentation revamp 4/5
- [MS18] Documentation revamp 5/5
- Revamp the `Web Applications` page
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logging-log4j2.