[SOLVED] SLF4J and Logback for non java log files


This Content is from Stack Overflow. Question asked by mah454

Can use SLF4J+Logback for non java applications log files ?
I mean if we have a log file named e.g. non-java.log can use RollingFileAppender for rotate this file ?
Note : imagine non-java.log generated by C/C++ or golang application .
Note : I know we can use syslog (in linux) or other OS utils ,but I want to understand logback can do something like syslog.


Slf4j and logback are written in java and solely for Java (or at least JVM based) languages:
They load java classes into JVM, they creat Java objects, manage memory in a sense that java objects do (no explicit descructors, relying on garbage collection) and so on and so forth.

Without java ecosystem (read jvm) its impossible to use these libraries.

The Log rotation is nothing but the code implemented in the relevant appender of the library, namely appender that writes to file.
Just to avoid confusions in terms: an appender is like a channel that can handle logs in one concrete way, like write to file, send via socket, print to console, etc.

So if your application that produces the logs runs on top of JVM – no problem using these libraries, otherwise you should either find an appropriate library in your language or choice or roll your own implementation.

This Question was asked in StackOverflow by mah454 and Answered by Mark Bramnik It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?