tinylog-org / tinylog

tinylog is a lightweight logging framework for Java, Kotlin, Scala, and Android
https://tinylog.org
Apache License 2.0
684 stars 83 forks source link

New syslog writer #156

Open aerturk opened 4 years ago

aerturk commented 4 years ago

Hello,

I think there is no feature in tinylog to send logs to a remote syslog server like other logging frameworks. If there a way to send to syslog by using another appender/binding or is it hard to add something like a syslogappender? Thank you.

thewindsofwinter commented 3 years ago

Hello! If there's no one working on this I could try to do this -- I'm not quite familiar with the code though so any steps I should go to get started in the right direction?

pmwmedia commented 3 years ago

Hi Any,

Firstly, you will need a JDK 9 for building tinylog: https://github.com/pmwmedia/tinylog#build-tinylog

All existing writers can be found here: tinylog-impl/src/main/java/org/tinylog/writers

There is also a manual how to create new writers: https://tinylog.org/v2/extending/#custom-writer

I hope these three steps are helpful for implementing the writer. Cannot await your pull request! Please let me know if I can support you somehow.

thewindsofwinter commented 3 years ago

Will JDK 11 also work or does it have to be JDK 9? I currently have JDK 11 and I don't want to install another one unless it's totally necessary. It says "Newer JDKs cannot compile legacy code" but in my experience usually I don't run into issues.

pmwmedia commented 3 years ago

For extracting stack trace information on runtime, tinylog 2 uses sun.reflect.Reflection for Java 6-8 and java.lang.StackWalker for Java 9+. This is one reason why tinylog is such fast in benchmarks. Unfortunately, Java 9 and 10 are the only Java versions that support both stack trace extracting APIs. Therefore, tinylog 2 does require Java 9 for building and Java 11 won't work. However, you can download OpenJDK 9 as compressed archive from the official website: https://jdk.java.net/archive/. It does not require any installation. Extracting the archive is enough.

An alternative would be implementing the new syslog writer directly for tinylog 3. This new version of tinylog uses method handles instead of deprecated sun.reflect.Reflection. This breaks support for Java 6 and 7, but does compile with Java 11.

thewindsofwinter commented 3 years ago

Alright, thank you very much!

pkarlowicz commented 11 months ago

Hello, I have created a new Syslog writer to address this issue, it's just my first time contributing to a github project and I have a few question about creating a pull request for the change, when trying to push changes to a branch I'm getting access denied error, do I need any access for it or should I create a pull request from a fork ?

pmwmedia commented 11 months ago

You need to fork tinylog. Afterwards you can push your changes to the branch v2.7 or v.3.0 of your fork. When you are done, you can create a pull request here in this project and choose your fork as base.