tinylog icon indicating copy to clipboard operation
tinylog copied to clipboard

New syslog writer

Open aerturk opened this issue 4 years ago • 7 comments

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.

aerturk avatar Jul 18 '20 10:07 aerturk

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?

thewindsofwinter avatar Feb 02 '21 23:02 thewindsofwinter

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.

pmwmedia avatar Feb 03 '21 00:02 pmwmedia

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.

thewindsofwinter avatar Feb 03 '21 01:02 thewindsofwinter

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.

pmwmedia avatar Feb 03 '21 20:02 pmwmedia

Alright, thank you very much!

thewindsofwinter avatar Feb 04 '21 22:02 thewindsofwinter

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 ?

pkarlowicz avatar Jul 29 '23 10:07 pkarlowicz

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.

pmwmedia avatar Jul 29 '23 17:07 pmwmedia