Improve logging infrastructure
It would be useful to centralize all log events.
Currently, there are too many alternatives to create log items: 1) The Eclipse logging framework, 2) Our ad-hoc logger (not really the most amazing piece of code), and 3) Console.println statements created by the scala compiler.
The idea is to plug Log4J and forward all log items to one single file which will be stored in ${workspace}/.metadata/.plugins/org.scala-ide.sdt.core/scala-ide.log.
Also, it would be nice that:
Currently, there are too many alternatives to create log items: 1) The Eclipse logging framework, 2) Our ad-hoc logger (not really the most amazing piece of code), and 3) Console.println statements created by the scala compiler.
The idea is to plug Log4J and forward all log items to one single file which will be stored in ${workspace}/.metadata/.plugins/org.scala-ide.sdt.core/scala-ide.log.
Also, it would be nice that:
- Scala > Run Setup Diagnostic could offer a way to programmatically change the default log level, and
- the Scala > Report a Bug dialog could have a link to open the log file in the Eclipse editor.
Leave a comment
(In revision:b94d4b82fe4bc7fd49969985a088ebd9cc5ab0f4) Improved logging infrastructure and plugged Log4J in the scala-ide.sdt.core
project.
We used to have too many alternatives to create log items (Eclipse Log
framework, our ad-hoc naive internal Logger and println statements originating
from scalac). In short, we did not have an ideal logging infrastructure.
Now, I plugged Log4J as the backend logger (I'll refer to it as the "default
logger" in the rest of this commit message), which replaces our naive ad-hoc
Logger. Further, all log events occurring in the Eclipse Log Framework are now
forwarded to the default logger. Also, the Standard Output and Standard Error
are redirected to the default logger. Naturally, the idea is to have a
single place to consult the log, and that is now the scala-ide.log file that
is produced by the default logger, located in
${workspace}/.metadata/.plugin/org.scala-ide.sdt.core/
It's easy to consult the log from within Eclipse, just click on the menu bar
Scala > Report a Bug, and the opened popup has a link that should open the
scala-ide.log file in the editor (though, mind that it is not automatically
refreshed while it's open).
You can also control the amount of produced log, i.e., you can set the log
level to accomodate your preferences (the default level is WARNING). To change
it, click on the menu bar Scala > Run Setup Diagnostic and you should see a
"Logging" box. There, you can change the log level and you can also enable a
console appender to print all produced log items in the console.
To get a handle on the loggers you simply need to mix-in the HasLogger trait,
which contains a reference to both the default logger and the Eclipse Log. You
may wonder why we have two loggers. The reason is simple, if you want to
communicate a message to the user, you should use the Eclipse Log. This becayse
messages sent to the Eclipse Log are shown in the Eclipse Log View (remember
that all messages sent to the Eclipse Log are also forwarded to the default
logger, so you don't need to log the same message twice). In all other cases,
you should use th default logger.
One element I'm not happy with is that I plugged Log4J within the
scala-ide.sdt.core project and not as an external plug-in. I've tried to do so
but failed due to my lack of understanding of OSGi. This is something that I
believe we should do at some point (maybe someone can help with this?!).
Finally, as part of this commit I also deleted the lib/miglayout.jar binary and
updated the scala-ide.sdt.core POM to copy both the log4j and miglayout
dependencies in the lib/ folder. This has a consequence in our project's setup
(yes, I'll update the doc), which is: you need to compile the project from the
command line before starting to work on the Scala IDE sources in Eclipse.
That because the dependencies to log4j and miglayout are copied in the lib
folder when maven runs the build of the org.scala-ide.psdt.core project.
I also noticed there is some duplication in the POMs and I think we should
refactor them a bit, but that should definitely be done in a separate commit
;).
Fixes #1000880.
Branch: issue/improved-logging-1000880
project.
We used to have too many alternatives to create log items (Eclipse Log
framework, our ad-hoc naive internal Logger and println statements originating
from scalac). In short, we did not have an ideal logging infrastructure.
Now, I plugged Log4J as the backend logger (I'll refer to it as the "default
logger" in the rest of this commit message), which replaces our naive ad-hoc
Logger. Further, all log events occurring in the Eclipse Log Framework are now
forwarded to the default logger. Also, the Standard Output and Standard Error
are redirected to the default logger. Naturally, the idea is to have a
single place to consult the log, and that is now the scala-ide.log file that
is produced by the default logger, located in
${workspace}/.metadata/.plugin/org.scala-ide.sdt.core/
It's easy to consult the log from within Eclipse, just click on the menu bar
Scala > Report a Bug, and the opened popup has a link that should open the
scala-ide.log file in the editor (though, mind that it is not automatically
refreshed while it's open).
You can also control the amount of produced log, i.e., you can set the log
level to accomodate your preferences (the default level is WARNING). To change
it, click on the menu bar Scala > Run Setup Diagnostic and you should see a
"Logging" box. There, you can change the log level and you can also enable a
console appender to print all produced log items in the console.
To get a handle on the loggers you simply need to mix-in the HasLogger trait,
which contains a reference to both the default logger and the Eclipse Log. You
may wonder why we have two loggers. The reason is simple, if you want to
communicate a message to the user, you should use the Eclipse Log. This becayse
messages sent to the Eclipse Log are shown in the Eclipse Log View (remember
that all messages sent to the Eclipse Log are also forwarded to the default
logger, so you don't need to log the same message twice). In all other cases,
you should use th default logger.
One element I'm not happy with is that I plugged Log4J within the
scala-ide.sdt.core project and not as an external plug-in. I've tried to do so
but failed due to my lack of understanding of OSGi. This is something that I
believe we should do at some point (maybe someone can help with this?!).
Finally, as part of this commit I also deleted the lib/miglayout.jar binary and
updated the scala-ide.sdt.core POM to copy both the log4j and miglayout
dependencies in the lib/ folder. This has a consequence in our project's setup
(yes, I'll update the doc), which is: you need to compile the project from the
command line before starting to work on the Scala IDE sources in Eclipse.
That because the dependencies to log4j and miglayout are copied in the lib
folder when maven runs the build of the org.scala-ide.psdt.core project.
I also noticed there is some duplication in the POMs and I think we should
refactor them a bit, but that should definitely be done in a separate commit
;).
Fixes #1000880.
Branch: issue/improved-logging-1000880
on 2012-01-27 10:30 *
By Mirco Dotta
(In revision:44c820ff773a90ca40566c28e222373c773da1d9) Improved logging infrastructure and plugged Log4J in the scala-ide.sdt.core
project.
We used to have too many alternatives to create log items (Eclipse Log
framework, our ad-hoc naive internal Logger and println statements originating
from scalac). In short, we did not have an ideal logging infrastructure.
Now, I plugged Log4J as the backend logger (I'll refer to it as the "default
logger" in the rest of this commit message), which replaces our naive ad-hoc
Logger. Further, all log events occurring in the Eclipse Log Framework are now
forwarded to the default logger. Also, the Standard Output and Standard Error
are redirected to the default logger. Naturally, the idea is to have a
single place to consult the log, and that is now the scala-ide.log file that
is produced by the default logger, located in
${workspace}/.metadata/.plugin/org.scala-ide.sdt.core/
It's easy to consult the log from within Eclipse, just click on the menu bar
Scala > Report a Bug, and the opened popup has a link that should open the
scala-ide.log file in the editor (though, mind that it is not automatically
refreshed while it's open).
You can also control the amount of produced log, i.e., you can set the log
level to accomodate your preferences (the default level is WARNING). To change
it, click on the menu bar Scala > Run Setup Diagnostic and you should see a
"Logging" box. There, you can change the log level and you can also enable a
console appender to print all produced log items in the console.
To get a handle on the loggers you simply need to mix-in the HasLogger trait,
which contains a reference to both the default logger and the Eclipse Log. You
may wonder why we have two loggers. The reason is simple, if you want to
communicate a message to the user, you should use the Eclipse Log. This becayse
messages sent to the Eclipse Log are shown in the Eclipse Log View (remember
that all messages sent to the Eclipse Log are also forwarded to the default
logger, so you don't need to log the same message twice). In all other cases,
you should use th default logger.
One element I'm not happy with is that I plugged Log4J within the
scala-ide.sdt.core project and not as an external plug-in. I've tried to do so
but failed due to my lack of understanding of OSGi. This is something that I
believe we should do at some point (maybe someone can help with this?!).
Finally, as part of this commit I also deleted the lib/miglayout.jar binary and
updated the scala-ide.sdt.core POM to copy both the log4j and miglayout
dependencies in the lib/ folder. This has a consequence in our project's setup
(yes, I'll update the doc), which is: you need to compile the project from the
command line before starting to work on the Scala IDE sources in Eclipse.
That because the dependencies to log4j and miglayout are copied in the lib
folder when maven runs the build of the org.scala-ide.psdt.core project.
I also noticed there is some duplication in the POMs and I think we should
refactor them a bit, but that should definitely be done in a separate commit
;).
Fixes #1000880.
Branch: issue/improved-logging-1000880
project.
We used to have too many alternatives to create log items (Eclipse Log
framework, our ad-hoc naive internal Logger and println statements originating
from scalac). In short, we did not have an ideal logging infrastructure.
Now, I plugged Log4J as the backend logger (I'll refer to it as the "default
logger" in the rest of this commit message), which replaces our naive ad-hoc
Logger. Further, all log events occurring in the Eclipse Log Framework are now
forwarded to the default logger. Also, the Standard Output and Standard Error
are redirected to the default logger. Naturally, the idea is to have a
single place to consult the log, and that is now the scala-ide.log file that
is produced by the default logger, located in
${workspace}/.metadata/.plugin/org.scala-ide.sdt.core/
It's easy to consult the log from within Eclipse, just click on the menu bar
Scala > Report a Bug, and the opened popup has a link that should open the
scala-ide.log file in the editor (though, mind that it is not automatically
refreshed while it's open).
You can also control the amount of produced log, i.e., you can set the log
level to accomodate your preferences (the default level is WARNING). To change
it, click on the menu bar Scala > Run Setup Diagnostic and you should see a
"Logging" box. There, you can change the log level and you can also enable a
console appender to print all produced log items in the console.
To get a handle on the loggers you simply need to mix-in the HasLogger trait,
which contains a reference to both the default logger and the Eclipse Log. You
may wonder why we have two loggers. The reason is simple, if you want to
communicate a message to the user, you should use the Eclipse Log. This becayse
messages sent to the Eclipse Log are shown in the Eclipse Log View (remember
that all messages sent to the Eclipse Log are also forwarded to the default
logger, so you don't need to log the same message twice). In all other cases,
you should use th default logger.
One element I'm not happy with is that I plugged Log4J within the
scala-ide.sdt.core project and not as an external plug-in. I've tried to do so
but failed due to my lack of understanding of OSGi. This is something that I
believe we should do at some point (maybe someone can help with this?!).
Finally, as part of this commit I also deleted the lib/miglayout.jar binary and
updated the scala-ide.sdt.core POM to copy both the log4j and miglayout
dependencies in the lib/ folder. This has a consequence in our project's setup
(yes, I'll update the doc), which is: you need to compile the project from the
command line before starting to work on the Scala IDE sources in Eclipse.
That because the dependencies to log4j and miglayout are copied in the lib
folder when maven runs the build of the org.scala-ide.psdt.core project.
I also noticed there is some duplication in the POMs and I think we should
refactor them a bit, but that should definitely be done in a separate commit
;).
Fixes #1000880.
Branch: issue/improved-logging-1000880
on 2012-01-27 10:45 *
By Mirco Dotta
(In revision:8a2537bbfb85b478d2b418c4f55b89b4fe532668) Improved logging infrastructure and plugged Log4J in the scala-ide.sdt.core
project.
We used to have too many alternatives to create log items (Eclipse Log
framework, our ad-hoc naive internal Logger and println statements originating
from scalac). In short, we did not have an ideal logging infrastructure.
Now, I plugged Log4J as the backend logger (I'll refer to it as the "default
logger" in the rest of this commit message), which replaces our naive ad-hoc
Logger. Further, all log events occurring in the Eclipse Log Framework are now
forwarded to the default logger. Also, the Standard Output and Standard Error
are redirected to the default logger. Naturally, the idea is to have a
single place to consult the log, and that is now the scala-ide.log file that
is produced by the default logger, located in
${workspace}/.metadata/.plugin/org.scala-ide.sdt.core/
It's easy to consult the log from within Eclipse, just click on the menu bar
Scala > Report a Bug, and the opened popup has a link that should open the
scala-ide.log file in the editor (though, mind that it is not automatically
refreshed while it's open).
You can also control the amount of produced log, i.e., you can set the log
level to accomodate your preferences (the default level is WARNING). To change
it, click on the menu bar Scala > Run Setup Diagnostic and you should see a
"Logging" box. There, you can change the log level and you can also enable a
console appender to print all produced log items in the console.
To get a handle on the loggers you simply need to mix-in the HasLogger trait,
which contains a reference to both the default logger and the Eclipse Log. You
may wonder why we have two loggers. The reason is simple, if you want to
communicate a message to the user, you should use the Eclipse Log. This becayse
messages sent to the Eclipse Log are shown in the Eclipse Log View (remember
that all messages sent to the Eclipse Log are also forwarded to the default
logger, so you don't need to log the same message twice). In all other cases,
you should use th default logger.
One element I'm not happy with is that I plugged Log4J within the
scala-ide.sdt.core project and not as an external plug-in. I've tried to do so
but failed due to my lack of understanding of OSGi. This is something that I
believe we should do at some point (maybe someone can help with this?!).
Finally, as part of this commit I also deleted the lib/miglayout.jar binary and
updated the scala-ide.sdt.core POM to copy both the log4j and miglayout
dependencies in the lib/ folder. This has a consequence in our project's setup
(yes, I'll update the doc), which is: you need to compile the project from the
command line before starting to work on the Scala IDE sources in Eclipse.
That because the dependencies to log4j and miglayout are copied in the lib
folder when maven runs the build of the org.scala-ide.psdt.core project.
I also noticed there is some duplication in the POMs and I think we should
refactor them a bit, but that should definitely be done in a separate commit
;).
Fixes #1000880.
Branch: issue/improved-logging-1000880
project.
We used to have too many alternatives to create log items (Eclipse Log
framework, our ad-hoc naive internal Logger and println statements originating
from scalac). In short, we did not have an ideal logging infrastructure.
Now, I plugged Log4J as the backend logger (I'll refer to it as the "default
logger" in the rest of this commit message), which replaces our naive ad-hoc
Logger. Further, all log events occurring in the Eclipse Log Framework are now
forwarded to the default logger. Also, the Standard Output and Standard Error
are redirected to the default logger. Naturally, the idea is to have a
single place to consult the log, and that is now the scala-ide.log file that
is produced by the default logger, located in
${workspace}/.metadata/.plugin/org.scala-ide.sdt.core/
It's easy to consult the log from within Eclipse, just click on the menu bar
Scala > Report a Bug, and the opened popup has a link that should open the
scala-ide.log file in the editor (though, mind that it is not automatically
refreshed while it's open).
You can also control the amount of produced log, i.e., you can set the log
level to accomodate your preferences (the default level is WARNING). To change
it, click on the menu bar Scala > Run Setup Diagnostic and you should see a
"Logging" box. There, you can change the log level and you can also enable a
console appender to print all produced log items in the console.
To get a handle on the loggers you simply need to mix-in the HasLogger trait,
which contains a reference to both the default logger and the Eclipse Log. You
may wonder why we have two loggers. The reason is simple, if you want to
communicate a message to the user, you should use the Eclipse Log. This becayse
messages sent to the Eclipse Log are shown in the Eclipse Log View (remember
that all messages sent to the Eclipse Log are also forwarded to the default
logger, so you don't need to log the same message twice). In all other cases,
you should use th default logger.
One element I'm not happy with is that I plugged Log4J within the
scala-ide.sdt.core project and not as an external plug-in. I've tried to do so
but failed due to my lack of understanding of OSGi. This is something that I
believe we should do at some point (maybe someone can help with this?!).
Finally, as part of this commit I also deleted the lib/miglayout.jar binary and
updated the scala-ide.sdt.core POM to copy both the log4j and miglayout
dependencies in the lib/ folder. This has a consequence in our project's setup
(yes, I'll update the doc), which is: you need to compile the project from the
command line before starting to work on the Scala IDE sources in Eclipse.
That because the dependencies to log4j and miglayout are copied in the lib
folder when maven runs the build of the org.scala-ide.psdt.core project.
I also noticed there is some duplication in the POMs and I think we should
refactor them a bit, but that should definitely be done in a separate commit
;).
Fixes #1000880.
Branch: issue/improved-logging-1000880
on 2012-02-03 16:15 *
By Mirco Dotta
(In revision:0ff7e44b12c9193c1cb12e7e609da71608fc4336) Improved logging infrastructure and plugged Log4J in the scala-ide.sdt.core
project.
We used to have too many alternatives to create log items (Eclipse Log
framework, our ad-hoc naive internal Logger and println statements originating
from scalac). In short, we did not have an ideal logging infrastructure.
Now, I plugged Log4J as the backend logger (I'll refer to it as the "default
logger" in the rest of this commit message), which replaces our naive ad-hoc
Logger. Further, all log events occurring in the Eclipse Log Framework are now
forwarded to the default logger. Also, the Standard Output and Standard Error
are redirected to the default logger. The goal is to have a single place
to consult the log, and that is now the scala-ide.log file that is produced
by the default logger, located in
${workspace}/.metadata/.plugin/org.scala-ide.sdt.core/
It's easy to consult the log from within Eclipse, just open the Eclipse
Preferences, then Scala > Logging, and there is a link to open the
scala-ide.log file in the editor (though, mind that it is not automatically
refreshed while it's open).
From the same preference's page, you can also control the amount of produced
log, i.e., you can set the log level that better suits you (the default level
is WARNING). If needed, you can also enable a console appender to print all
produced log items in the console (this is quite handy when doing development
on the Scala IDE sources).
To get a handle on the loggers you simply need to mix-in the HasLogger trait,
which contains a reference to both the default logger and the Eclipse Log. You
may wonder why we have two loggers. The reason is simple, if you want to
communicate a message to the user, you should use the Eclipse Log. This becayse
messages sent to the Eclipse Log are shown in the Eclipse Log View (remember
that all messages sent to the Eclipse Log are also forwarded to the default
logger, so you don't need to log the same message twice). In all other cases,
you should use th default logger.
Finally, I removed the "plugininfo" option, which it was used to enable debug
information in the ScalaIndexBuilder. As a matter of fact, the amount of logged
information can now be easily controlled through Log Levels.
One element I'm not happy with is that I plugged Log4J within the
scala-ide.sdt.core project and not as an external plug-in. I've tried to do so
but failed due to my lack of understanding of OSGi. This is something that I
believe we should do at some point (maybe someone can help with this?!).
Fixes #1000880.
Branch: master
project.
We used to have too many alternatives to create log items (Eclipse Log
framework, our ad-hoc naive internal Logger and println statements originating
from scalac). In short, we did not have an ideal logging infrastructure.
Now, I plugged Log4J as the backend logger (I'll refer to it as the "default
logger" in the rest of this commit message), which replaces our naive ad-hoc
Logger. Further, all log events occurring in the Eclipse Log Framework are now
forwarded to the default logger. Also, the Standard Output and Standard Error
are redirected to the default logger. The goal is to have a single place
to consult the log, and that is now the scala-ide.log file that is produced
by the default logger, located in
${workspace}/.metadata/.plugin/org.scala-ide.sdt.core/
It's easy to consult the log from within Eclipse, just open the Eclipse
Preferences, then Scala > Logging, and there is a link to open the
scala-ide.log file in the editor (though, mind that it is not automatically
refreshed while it's open).
From the same preference's page, you can also control the amount of produced
log, i.e., you can set the log level that better suits you (the default level
is WARNING). If needed, you can also enable a console appender to print all
produced log items in the console (this is quite handy when doing development
on the Scala IDE sources).
To get a handle on the loggers you simply need to mix-in the HasLogger trait,
which contains a reference to both the default logger and the Eclipse Log. You
may wonder why we have two loggers. The reason is simple, if you want to
communicate a message to the user, you should use the Eclipse Log. This becayse
messages sent to the Eclipse Log are shown in the Eclipse Log View (remember
that all messages sent to the Eclipse Log are also forwarded to the default
logger, so you don't need to log the same message twice). In all other cases,
you should use th default logger.
Finally, I removed the "plugininfo" option, which it was used to enable debug
information in the ScalaIndexBuilder. As a matter of fact, the amount of logged
information can now be easily controlled through Log Levels.
One element I'm not happy with is that I plugged Log4J within the
scala-ide.sdt.core project and not as an external plug-in. I've tried to do so
but failed due to my lack of understanding of OSGi. This is something that I
believe we should do at some point (maybe someone can help with this?!).
Fixes #1000880.
Branch: master