Giter Site home page Giter Site logo

Comments (6)

rfoltyns avatar rfoltyns commented on May 26, 2024

At the moment there's no other way.

But I'm open to PRs if you'd like to add support for configurable modules. I can add a method to make this extension easier and pave the way for later improvements. Most probably sth like:

protected Builder configureModules(ObjectMapper)

called exactly where you suggested.

from log4j2-elasticsearch.

haikal00 avatar haikal00 commented on May 26, 2024

This means to have list of jackson module being registered just like how Mixins is registered.
So user will include the module in the class path (maven pom dependency), and register that in the log4j2.xml?

from log4j2-elasticsearch.

rfoltyns avatar rfoltyns commented on May 26, 2024

Yes, but rather more like virtual properties, not mixins. Mixins rely on loadClassand I'm not a fan on clazz.newInstance() here. Here, module instance should be ready to use once it's added to the builder via withJacksonModules(JacksonModule[]).

It's all about creating proper skeleton for this. JacksonModule interface maybe? JacksonModule.applyTo(ObjectMapper) should ensure enough flexibility and extensibility with following philosophy in mind:

Want to add a module? You have to provide an implementation on your own, but in exchange you can then customize the mapper any way you want

Few more thoughts:

  • ExtendedLog4j2JsonModule can be migrated as-is - let's just make sure that it's added to the default list and never replaced(!), because it sets up mixins required for serialization. Mixins can be overriden later with JacksonMixIn, so having it set up like that is not an issue.

  • JacksonAfterburnerModuleConfigurer may have to be migrated at some point as well (afterburner flag might be tricky though). AfterburnerModule class MUST be loaded ONLY if flag is set to true.

  • only concern is the config order. I guess that this one should work for a start:

  1. modules
  2. mixins
  3. virtual properties

from log4j2-elasticsearch.

rfoltyns avatar rfoltyns commented on May 26, 2024

Custom module support will be released in 1.5.

from log4j2-elasticsearch.

rfoltyns avatar rfoltyns commented on May 26, 2024

@haikal00 would you like to test the new functionality with a SNAPSHOT version to verify that it works as you expected?

from log4j2-elasticsearch.

rfoltyns avatar rfoltyns commented on May 26, 2024

Released in 1.5.0.

Enjoy!

from log4j2-elasticsearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.