GithubHelp home page GithubHelp logo

tersesystems / echopraxia Goto Github PK

View Code? Open in Web Editor NEW
53.0 3.0 1.0 2.25 MB

Java Structured Logging API for Logback, Log4J2, and JUL

Home Page: https://tersesystems.github.io/echopraxia/

License: Other

Java 99.88% HCL 0.12%
logging logback structured-logging slf4j contextual-logging conditional-logging java

echopraxia's People

Contributors

wsargent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

wsargent

echopraxia's Issues

Allow conditions on statement to use statement fields

It's worth the cost of evaluating a field builder function if the condition is explicitly on the statement. Running through fields isn't the same as actually logging it, and the implication is that the condition is important enough to carry through.

Better Value API

Using Value<List<Field>> etc rather than using ArrayValue is obscure and doesn't really help anything.

Also, Field.Valuerather than just Value is a bit odd.

Async processing

Executing conditions could be arbitrarily expensive.

Especially for statement logging which is a side effect, there's no reason we can't make this async and take the load off the rendering thread.

Either use CompletionStage API:

AsyncCondition asyncCondition = (level, context) -> CompletableFuture.completedFuture(true);
logger.info(asyncCondition, "Message {}", fb -> ...);

or offload it using an executor:

logger.withExecutor(executor).withCondition(condition).info("Message {}", fb -> ...);

Obviously predicates wouldn't work in this model:

if (logger.isDebugEnabled(condition)) {
   ???
}

Instead you'd need to do something like:

logger.isDebugEnabled(condition).thenRun(() -> logger.debug("foo")); // rendering thread
logger.isDebugEnabled(condition).thenRunAsync(() -> logger.debug("foo")); // condition's thread

Might need a special logger to do this if we extend it to predicates and builders.

Obviously the logging statement itself would occur in a different thread at this point, as it would be post condition. Also anything involving thread-local storage / servlets would need special handling. This would require special-case MDC/NDC handling as well. :-(

Structured arguments in MDC

Hey,

would it be possible to put structured arguments optionally into the MDC?

Maybe my use case is a bit special: I am using Quarkus and there you cannot easily replace jboss-logmanager with logstash, which makes everything a bit of a pain. Additionally, I want to post log entries via gelf/fluent to elastic and there is a gelf plugin for Quarkus, which includes everything put into the MDC.

I know I can write my own wrapper or interceptor, but really would like to keep the nice field builders from Echopraxia.

UserFunction through scripts is slow

If the find methods go through a script, something is making it much slower than if being called directly.

Benchmark                                      Mode  Cnt     Score     Error  Units
ScriptingBenchmarks.testFileConditionFail      avgt    5  4379.959 ± 579.831  ns/op
ScriptingBenchmarks.testFileConditionMatch     avgt    5  4610.075 ± 147.281  ns/op
ScriptingBenchmarks.testStringConditionFail    avgt    5  4649.784 ±  87.629  ns/op
ScriptingBenchmarks.testStringConditionMatch   avgt    5  4262.437 ± 191.742  ns/op
ScriptingBenchmarks.testWatchedConditionFail   avgt    5  5242.896 ±  93.665  ns/op
ScriptingBenchmarks.testWatchedConditionMatch  avgt    5  4700.055 ±  87.745  ns/op

See #129

Add a test for script compilation thread safety

Somehow a call can have a void return type, which means that calling call.bool() can fail. Need to check for the return type and not call bool() if it doesn't have the right return type.

str.starts_with?(fields[:request_remote_addr], "127")

compatibility issue when upgrade to 2.3.0

There was a problem when upgrading to version 2.3.0. Initially, version 2.2.4 was used and the system was working fine. However, after upgrading to version 2.3.0, the system could not start and an error message appeared stating "java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder". Upon investigation, it was discovered that version 1.4.6 of logback was being used in the system, and this version does not have the class "org.slf4j.impl.StaticLoggerBinder". Is this a compatibility issue introduced by version 2.3.0? Can it be fixed?

Make extending Logger<> easier

  • Account for NeverLogger, including defaults for null ops
  • Provide better defaults for the with methods
  • Provide a single constructor method for instantiating new MyLogger

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.