Getting PostSharp 6.0.32 and Log4Net 2.0.0 to log at a custom level - postsharp

We are using PostSharp with Log4Net as a back end. I am trying to get PostSharp to log at a different level to our manually added log statements which are at DEBUG level.
I've tried setting the postsharp.config file option below:
<LoggingProfile Name="default" IncludeSourceLineInfo="True">
<DefaultOptions>
<LoggingOptions Level="Trace"/>
</DefaultOptions>
</LoggingProfile>
But that doesn't seem to work.
I've overridden the Log4NetLoggingBackend to try and intercept the Trace level but it seems that when setting the PostSharp level to Trace, it doesn't hit any of the custom backend code.
Have I missed out a crucial step?

The configuration snippet shown in the question looks correct. Please note, however, that in the configuration file you set the PostSharp logging level that is then mapped to the logging level of the target logging back-end (log4net in this case). Both LogLevel.Trace and LogLevel.Debug map to the Debug level in log4net because the log4net library doesn't offer Trace level.
You can try to set level to Info to test that your configuration file works as expected.

Related

Enable a DEBUG flag in Eclipse internal JavaBuilder

There is a class in the Eclipse source code called JavaBuilder[1], which ​has DEBUG and SHOW_STATS flags (static boolean) that I'd like to enable to debug build issues, since they enable printing reasons for rebuild, eg:
if (DEBUG)
System.out.println("JavaBuilder: Performing full build since last saved state was not found");
I am guessing that they can be enabled with some argument in "eclipse.ini"?
I'd like to know what the argument syntax is, and where Eclipse's stdout is logged to.
Or if one can enable them without restarting Eclipse, of course.
[1] org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java
Looks like this is set by the org.eclipse.jdt.core/debug/builder trace option. The org.eclipse.jdt.core/debug option must also be set.
You can set this option by enabling tracing in the Preferences in the 'General > Tracing' page or by using a .options file (see this question)
The org.eclipse.jdt.internal.core.JavaModelManager class defines the trace options for the JDT code.

How to change the log level properties in Talend open studio 7.1.1

I am Trying to set the log level for my Data Integration job in Talend studio version 7.1.1 to "Warn". Looks like the option is no longer available in Run --> Advanced Settings. How do I change log levels in talend 7.1.1? Please clarify. Thanks
Try looking under File, Project settings, Log4j. You should be able to customise the level of the logs there.

Slick logging with slf4j-simple

I am using slf4j-simple in my project. I would like to change logging level for slick to INFO. After reading Logging options for Slick
and Class SimpleLogger docsI have tried to add following options to my VM line:
-Dorg.slf4j.simpleLogger.defaultLogLevel=INFO
-Dlogger.scala.slick=INFO
-Dlogger.scala.slick.jdbc.JdbcBackend.statement=INFO
-Dorg.slf4j.simpleLogger.log.scala.slick=INFO
I see a few INFO level logs comming from jetty, therefore the basic logging seems to be working. I am also able to change level of logs shown by using -Dorg.slf4j.simpleLogger.defaultLogLevel=TRACE, but even that only shows more jetty logs, no Slick logs are shown to me.
How can I configure slf4j-simple to shown slick logs to me?
According to http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html the correct system property should be
-Dorg.slf4j.simpleLogger.log.scala.slick=debug
instead of
-Dlogger.scala.slick=INFO
For reference, the list of all loggers used by Slick can be found in logback.xml. We only use the debug level with all of them.

NUnit - how to include logging

Any Sample on NUnit default logger to log the information. Some documentation says log4net is not supported now. Appreciate your help.
Thanks,kumar.
You can use the normal .NET Trace or Debug classes to log messages that NUnit will later display.
You can add Common.Logging reference (with log4net) and add ConsoleAppender in your configuration file. After configuring the appender you will see logging information when running your unit tests.

How to suppress all warnings using MSBuild

How would I suppress all warnings (or at least as many as possible since those prefixed with MSB cannot be suppressed How to suppress specific MSBuild warning)?
msbuild /clp:ErrorsOnly
/consoleloggerparameters:
Parameters to console logger. (Short form: /clp)
The available parameters are:
PerformanceSummary--Show time spent in tasks, targets
and projects.
Summary--Show error and warning summary at the end.
NoSummary--Don't show error and warning summary at the
end.
**ErrorsOnly--Show only errors.**
WarningsOnly--Show only warnings.
NoItemAndPropertyList--Don't show list of items and
properties at the start of each project build.
ShowCommandLine--Show TaskCommandLineEvent messages
ShowTimestamp--Display the Timestamp as a prefix to any
message.
ShowEventId--Show eventId for started events, finished
events, and messages
ForceNoAlign--Does not align the text to the size of
the console buffer
DisableMPLogging-- Disable the multiprocessor
logging style of output when running in
non-multiprocessor mode.
EnableMPLogging--Enable the multiprocessor logging
style even when running in non-multiprocessor
mode. This logging style is on by default.
Verbosity--overrides the /verbosity setting for this
logger.
The best way is to fix the issues that are causing the warnings.
If you must ignore the warnings (e.g. you have inherited a project with so many that you can't see the wood for the trees), you could try changing the WarningLevel property, http://msdn.microsoft.com/en-us/library/13b90fz7.aspx
If you would like to suppress MSB3270 only then you can set in project file just
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
None
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
In Jenkins
Happened upon this Googling "how to suppress MSBuild warnings in Jenkins"
So much noise like the following in our console output, couldn't find the meat
Missing XML comment for publicly visible type or member
Inherited Jenkins on a Windows server
Manage Jenkins > Global Tool Configuration > MSBuild
Add /clp:ErrorsOnly to the Default parameters