quarkiverse / quarkus-logging-json

Quarkus logging extension outputting the logging in json.
Apache License 2.0
63 stars 30 forks source link

enabling file logging as well #190

Closed dfa1 closed 2 years ago

dfa1 commented 2 years ago

it is possible to enable logging to a file using this library?

We tried "quarkus.log.file.json" but it not picking up this library at all. Any ideas? /cc @SlyngDK Now we have a workaround on our side, basically defining a custom processor:

  @BuildStep
  @Record(ExecutionTime.RUNTIME_INIT)
  LogFileFormatBuildItem setUpFormatter(Capabilities capabilities, LoggingJsonRecorder recorder, Config config) {
  ...

please note the use of LogFileFormatBuildItem rather than LogConsoleFormatBuildItem to enable usage of files.

piyush-dig commented 2 years ago

@SlyngDK I think a fix for this was merged in Quarkus via https://github.com/quarkusio/quarkus/pull/25505.

Do we just need a new release or are there any changes required on the library side for this to work? I'll truly appreciate your help to resolve this.

SlyngDK commented 2 years ago

There needs to be added a @BuildStep, but also some work on the config structure. Maybe best to move some part of the config around, and create a new major version :thinking:

I am not having the time to look at right now, I will take a look at it in Oct.

dfa1 commented 2 years ago

@SlyngDK thank you :) I have some code already in my local fork: basically adding the @BuildStep but I stopped before started working in the config structure. Do you have any directions there?

SlyngDK commented 2 years ago

@dfa1 I think it is ready in #199 will you be able to test??

Configuration has moved to quarkus.log.json.<>, and to enable file formatting quarkus.log.json.file.enable=true.

Docs for config https://github.com/quarkiverse/quarkus-logging-json/blob/file-formatter/docs/modules/ROOT/pages/includes/quarkus-log-json.adoc

When released it will be a new major.

dfa1 commented 2 years ago

@SlyngDK hi! looks good to me... but I need a release (by company policy I can use only artifacts deployed on maven central).

Would it be possible to have a rc or beta? thanks!

SlyngDK commented 2 years ago

@gsmet Is it possible to create a RC release? Do you have any examples of doing that, not taking too much time.

gsmet commented 2 years ago

@SlyngDK not really, you can only push a release from the content of the repository.

gsmet commented 2 years ago

So to be clear: you can merge and release a CR by adjusting the project.yml to release a CR but you cannot release something from a PR.

dfa1 commented 2 years ago

@SlyngDK @gsmet thank you! Since, there are some breaking changes, maybe at least one "2.0 release candidate" would be wise? I will happily provide early testing :)

SlyngDK commented 2 years ago

@dfa1 I have released 2.0.0.