We have .NET 4 application that does some logging.
When the application is launched from Studio, there's no output in the Debug view.
When the application is launched from WinDbg, the logging is shown as expected.
I've read that there was a change in .NET 4 preventing the logging from showing up in both Studio and WinDbg, but it doesn't seem to show up in Studio at all now. Before the solution was upgraded, it did log as expected in VS2008.
Why is the Debug output showing up correctly when launched from WinDbg but not when launched from VS2010?
This was due to a misconfigured log4net.config file.
Added the <appender> block and <appender-ref> block to reference said appender.
<log4net>
...
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\r\n" />
<param name="Footer" value="[Footer]\r\n" />
<param name="ConversionPattern" value="%d [%t] %-5p %m%n" />
</layout>
</appender>
<root>
...
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
Related
We have an issue where whenever our Gatling performance tests are run the .log file that should generate at the root of the folder is not there.
This is my whole logback file if anyone able to help please.
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter> -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
<immediateFlush>true</immediateFlush>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>testFile.log</file>
<append>false</append>
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
</encoder>
</appender>
<!-- uncomment and set to DEBUG to log all failing HTTP requests -->
<!-- uncomment and set to TRACE to log all HTTP requests -->
<logger name="io.gatling.http.engine.response" level="TRACE" />
<root level="WARN">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
Thank you very much.
Update
It seems the issue may be with IntelliJ itself as noticed we can see the file when going directly to the finder.
Disabling custom plugins should help. Seems one of configuration was corrupted.
There's a good chance the file is simply not generated where you expect it. Try setting an absolute path instead to verify.
I'm wondering if there is a way to debug the sql command that SQL Query component executes at runtime?
I know placing a "console.log()" can debug components but SQL Query does not have an event to set the console up
Regards,
Erick
Shutdown Pentaho Server, goto YOURDRIVE:\pentaho\biserver-ce\tomcat\webapps\pentaho\WEB-INF\classes\
Open log4j.xml and uncomment this section:
<!--
<appender name="SQLLOG" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="../logs/mondrian_sql.log"/>
<param name="Append" value="false"/>
<param name="MaxFileSize" value="500KB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
<category name="mondrian.sql">
<priority value="DEBUG"/>
<appender-ref ref="SQLLOG"/>
</category>
-->
GOTO YOURDRIVE:\pentaho\biserver-ce\pentaho-solutions\system\mondrian
, open mondrian.properties, make sure below code is set to "true"
mondrian.rolap.generate.formatted.sql=true
Start the Pentaho server now, it will start making mysql log file in the "YOURDRIVE:\pentaho\biserver-ce\tomcat\logs\" folder when you execute the sql statements...
I ended up debugging thru SQL Server Management Studio
I've problem with log4net where it doesn't work in client pc but in my development pc it can create and write to the log file.
My VSTO add-in is using log4net (installed log4net package using NuGet). So inside my add-in ribbon code, I've added the following code :
Ribbon.vb
<Assembly: log4net.Config.XmlConfigurator(Watch:=True)>
<Runtime.InteropServices.ComVisible(True)> _
Public Class WordRibbon
Implements Office.IRibbonExtensibility
Private ribbon As Office.IRibbonUI
Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
......
app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false" />
</configSections>
<log4net>
<root>
<level value="ALL"/>
<appender-ref ref="RollingFileAppender"/>
</root>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="%envFolderPath{MyDocuments}\MyApp\AddInLog\WordAddin-log.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="5MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger - %message%newline" />
</layout>
</appender>
</log4net>
When I ran MS Word in my development PC (either debug from Visual Studio 2013 OR directly ran MS Word), log4net will be able to create the logfile inside MyDocuments folder.
But when I ran the add-in inside a clean virtual machine, there's no log file created. THere's no error prompted. Am I missing something here?
I found out the problems in vsto 4.0 sp1 will cause a VSTO Addin to not find its config file link.
Difference is in my case, the add-in can be loaded properly and it's working. It just the log4net somehow didn't work.
Before:
In the add-in registry, the Manifest value will be something like
Manifest="C:\Program Files\MyApp\WordAddIn.vsto|vstolocal"
After:
In the blog, the writer suggested for below changes.
Manifest="file:///C:/Program Files/MyApp/WordAddIn.vsto|vstolocal"
And I think that's the reason why log4net can work in my development pc, because Visual Studio use the same URI format for the Manifest value.
But for my case, I tried below and it can also work.
Manifest="C:\Program Files\MyApp/WordAddIn.vsto|vstolocal"
I use this URI because in my app, during installation the addin registry value path will be created based on users selection. If I want to change it to file:///, this will involved a few different files (not just the add-ins), so for now this is my solutions.
I'm not sure if using this format can cause any problem.
I have an asp.net website that is utilizing log4net. Due to several third party libraries (like NHibernate), there are several appenders across multiple threads. IIS is setup so there should be only one process. I have confirmed this by utilizing the process id in the filename.
Web.config Excerpt:
<appender name="AppAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="Logs\App_[%processid]_.log" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="yyyy-MM-dd" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="false" />
<preserveLogFileNameExtension value="true" />
<threshold value="DEBUG" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value=" %date %-5level [%property{SessionId}] - %message%newline" />
</layout>
</appender>
When recycling the app pool in IIS I sometimes get these errors:
log4net:ERROR [RollingFileAppender] ErrorCode: GenericFailure. Unable to acquire lock on file App_[6844]_2014-12-18.log. Access to the path 'App_[6844]_2014-12-18.log' is denied.
My question, is are some of these error inevitable because its multi-threaded, or if configured properly should they never occur.
Additional Info:
I'm using log4net 1.2.13 (installed over nuget)
Frozen Mountain's WebSync (3.5.1.3), also note that this library directly references log4net 1.2.11, I used a bindingRedirect to 1.2.13
NHibernate version 3.1.0.400, it was the first version to not use log4net 1.2.10
**NHibernate can easily be upgraded if we think thats the problem. WebSync would be more difficult.
So I'm using log4net to write log output to the trace. Show sql is specified in the configuration file. I seem to have to set the log output level to DEBUG to get the SQL output, but DEBUG also produces pages and pages of other guff I have to scroll past.
Can I get the SQL without the guff?
Thanks
David
You can add a logger for NHibernate.SQL in the log4net config block, like so:
<logger name="NHibernate.SQL" additivity="false">
<level value="DEBUG" />
<appender-ref ref="ConsoleAppender" />
</logger>
With the appender-config
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date - %message%newline"/>
</layout>
</appender>
(replace this with whatever you prefer, like rollingFileAppender)
Another option is using a tool like NHibernate Profiler.