Comments (11)
Thank you for the good word! 👍
I agree, unfortunately basic good practices are not followed when it comes to package names. In most cases it's due to the need to access package-private or protected classes, either for extensions (see *MixIn classes) or to introduce some performance improvements - com.fasterxml.jackson.core
is a good example as it needs to do some wizardry with JsonWriteContext in single threaded mode.
Also, most classes are just dumped into the main package - this will change in 2.0 (end of next year at least) when core
will be split into multiple modules.
I'll have a look at those packages and see what I can do. So far:
com.fasterxml.jackson.core
package along with the rest of single thread optimisations are good candidates for extraction to separate jar (it would happen eventually anyway)org.appenders.core.logging
is one of the first steps towards repackaging in 2.0 - may as well be a separate jar already (it would happen anyway)org.apache.logging.log4j.core.jackson
needs access to Log4j2 mixins - otherwise I'd have to copy those classes 1-to-1.. maybe athirdparty
package would be a good one for these ones?
Is this issue blocking you completely atm? Is 1.4.4 unusable for you?
from log4j2-elasticsearch.
I'm not blocked, that's a kind of general question. I'm doing modules since years, but my descendants in company could be not very happy after taking over such legacy.
If I simply say "I will not use singleThread option", package 'com.fasterxml.jackson.core' is optional. I must omit this export and that's all (classes from this package will be never loaded, if this option is disabled).
Splitting that to separate jars will be a good approach. Then I could load 'com.fasterxml.jackson.core' as fragment bundle (kind of trick to attach it to jackson-core bundle). But keeping all of thirdparties in single jar will be also problematic (I can attach fragment to only one host bundle).
from log4j2-elasticsearch.
"I will not use singleThread option", package 'com.fasterxml.jackson.core' is optional. I must omit this export and that's all (classes from this package will be never loaded, if this option is disabled)
I was really hoping that this single design decision and classloading tricks will do the job for all cases..
Separate jar for jackson package-private classes would also contain actual SingleThreadJsonFactory
from org.appenders.log4j2.elasticsearch
. I'm not sure how well fragment bundles would handle that.
Shading classes into org.appenders.log4j2.elasticsearch.thirdparty
might be a way to go for Log4j2 classes here. Similar approach was taken in Netty project - JCTools collections are shaded to prevent any classloading issues. I was reluctant to do it this way, but I might have to re-consider.
from log4j2-elasticsearch.
will do the job for all cases..
For openjdk, I would say - yes. I'm only using this for container environment in kubernetes, so I could feel safe with that (no other implementation could be used accidentally).
Separate jar for jackson package-private classes would also contain actual SingleThreadJsonFactory from org.appenders.log4j2.elasticsearch. I'm not sure how well fragment bundles would handle that.
It would handle, but if SingleThreadJsonFactory have their separate unique package name (that could be exported and consumed elsewhere).
Yes, I'm also not a huge fan of shading classes. But decision about that should be consulted with question "Am I using internal APIs of third party library, that could be incompatibly changed between versions without notice?". Jackson library in the past had breaking changes between minor versions.
Anyway, sometimes it's easier to handle such things with reflection (checking unaccessible field existence before reading). And reflection it's pretty fast in last JRE implementations. Or even multi approach, checking conditions via reflection before loading faster hacks.
from log4j2-elasticsearch.
Incompatibility is a risk with both reflection and package-private access approaches. I'll be very reluctant to add any reflection-based logic to the code base. If there's a need for a package-private access, I'd rather try to contribute to the source project to make this access easier.
reflection it's pretty fast in last JRE implementations
Regardless of latency, it just feels wrong. If property is private, there's a reason for it. If it's package-private or protected - I can take the risk, especially if it's on the hot path.
from log4j2-elasticsearch.
Thankfully, repackaging will be possible after jackson-core:2.12.0
release. Thanks, Tatu! 👍
I'll release it in 1.5 if possible.
from log4j2-elasticsearch.
Good to hear. Please, send me a notification before release, I will try to check it for compatibility in modular system.
from log4j2-elasticsearch.
com.fasterxml.jackson.core
classes were moved to appenders-jackson-st. compile
scope, but not required by default.
I'll extract org.appenders.core.logging
in 1.5.0 as well.
Can you handle org.apache.logging.log4j.core.jackson
? I'd would just deprecate it and repackage in 2.0.
from log4j2-elasticsearch.
looks good for me. I really appreciate it.
with org.apache.logging.log4j.core.jackson I have no problems at the moment, because it's not exported explicitly by pax-logging (no version conflict).
from log4j2-elasticsearch.
org.appenders.core.logging
classes were moved to appenders-logging.
I pushed latest log4j2-elasticsearch snapshots to Sonatype repos.
from log4j2-elasticsearch.
Released in 1.5.0.
org.apache.logging.log4j.core.jackson
will be moved in 2.0.
Enjoy!
from log4j2-elasticsearch.
Related Issues (20)
- Supporting ecs-logging-java HOT 8
- How to pass the value from ThreadContext to ValueProperty? HOT 3
- Can not log to elastic using log4j2 <PatternLayout> HOT 11
- Support elasticsearch data_streams HOT 6
- Failed to Load StackTraceElementMixIn HOT 22
- InvalidTypeNameException on invalid mappingType in ES 5 HOT 8
- Adding custom properties, that change during processing HOT 4
- Log4j2 Zero-Day vulnerability (CVE-2021-44228) HOT 2
- Support OpenSearch 2.x and Elasticsearch 8.x HOT 9
- Unable to determine if index already exists HOT 1
- Support for ECSLayout for elasticsearch-ahc and / or elaticsearch-jest in combination with data streams HOT 10
- Is it possible to deseriailze JSON within the message into properties? HOT 2
- Run elastic search appender in specific environment HOT 2
- Logging-Cleaner ERROR Could not create plugin HOT 3
- How do I add mdc attributes? HOT 1
- Could not initialize ChronicleMapRetryFailoverPolicy HOT 2
- ServiceDiscovery ERROR HCServiceDiscovery: Unable to refresh addresses: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" HOT 1
- Using log4j2-elasticsearch-hc -> Does AsyncLogger still not support adding dynamic keyValue pairs in Jackson JSONLayout HOT 5
- IS JacksonModule is implemented in latest version? HOT 7
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 log4j2-elasticsearch.