Hi,

> In my opinion the e4-Logger-"API" is completely flawed and we need to
> first fix this or completely get rid of Logger #

+1 for getting rid of it.

> and go for slf4j.

±0. I’m undecided yet. While I clearly see the advantage of SLF4J, to be of 
real value (I think) we'd need a little more than a plain SLF4J logger offers 
out of the box when logging in Eclipse (UI).

Besides logging to files, System.out etc. it should be possible to log directly 
to the Eclipse Error Log view as well. This can generally be achieved by a 
specific Appender. However, to create meaningful log messages in Eclipse, a 
logging event should contain information about (i) the bundle that logged the 
messages (String pluginId in IStatus), and  (ii) an error code (int code in 
IStatus). 

There is no obvious solution to this. While (i) may be solved by creating a 
your own LoggerFactory and Logger implementation (which delegates to, say, 
Logback but adds additional information like the plugin id to a logging event), 
I see no obvious solution to offer unique error codes for each logging message. 
Maybe someone else has achieved something similar before? FWIW, I thought about 
using Markers for error codes, but they are too limited and not very handy to 
use for that purpose.


Regarding Tom’s logger. The key difference to between Tom’s interface and other 
logger interfaces are additional <loglevel>f() convenience methods; the feature 
to get a logger injected, could be implemented for any logging framework in 
E4/Guice (please correct me if I’m wrong here, Tom).

One advantage of Tom’s API over SLF4Js API, however, are those convenience 
methods that take a message-format + message-arguments + stacktrace (!). This 
is (for whatever reasons) not part of SLF4J’s Logger API which makes it a pain 
to use IMHO.


So, here we stand:

SLF4J does out of the box (i) not offer plugin-ids, (ii) not offer sufficient 
support for error codes, and (iii) lacks some convenience logging methods in 
its Logger API.


While I can think of a solution for (i), I find (ii) and (iii) annoying.


I’ve no clear recommendation yet.

Best,
Marcel


Am 15.08.2014 um 20:15 schrieb Tom Schindl <[email protected]>:

> Hi,
> 
> I've seen bug reports from Lars' where he suggest using Logger in our
> code base, while I think the general intent is very good, we should
> first discuss how we proceed with the Logger-Stuff.
> 
> In my opinion the e4-Logger-"API" is completely flawed and we need to
> first fix this or completely get rid of Logger and go for slf4j.
> 
> There was an on going discussion on the architecture council to
> streamline Logging@Eclipse by Marcel Bruch (I cced him) where John
> suggested that we remove Logger and go for slf4j.
> 
> On the other hand I'd like to point you towards the work we have done at
> e(fx)clipse where one of our runtime bundles provides a Logger-API and
> you can get access to the a Logger [1] with
> 
> class Bla {
>  @Inject
>  @Log
>  Logger logger
> }
> 
> or if you are in Guice
> 
> class Bla {
>  @Log
>  Logger logger
> }
> 
> See https://wiki.eclipse.org/Efxclipse/Runtime/Recipes#Logging, we
> currently support the following backends:
> * java.util.logging
> * log4j
> * slf4j
> 
> Tom
> 
> [1]http://efxclipse.bestsolution.at/doc/api/index.html?org/eclipse/fx/core/log/Logger.html

_______________________________________________
e4-dev mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/e4-dev

Reply via email to