logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qiu-xia.Zh...@sybase.com
Subject Can log4net be used with Test Project type project in Visual Studio Team System 2005 Beta2 (VSTS)
Date Thu, 16 Feb 2006 04:51:23 GMT
I create a Test Project in VSTS. This kind of project is a special type of 
project test methods in which can be recognized by Test Manager window or 
Test View window.
I modify the code in the project with some logging code with log4net.
Then run it from Visual Studio Command Prompt with MSTest, or from Test 
Manager window.
But no log file created with logging message.
Does log4net support Test Project in VSTS? I looked into the source code 
of log4net and found there is a "GetExecuteAssembly()". The return value 
of this in my Test project is null.
Perhaps this is because Test project does not have an AssemblyInfo.cs when 
created. So even if I add an AssemblyInfo.cs with log4net info, the log 
still not generated.
Do you know why and the solution?

My configuration is as follows which acts well in another Console App.:
1 AssemblyInfo.cs:[assembly: log4net.Config.XmlConfigurator(Watch = true)] 

2 App.config: 
<?xml version="1.0" encoding="utf-8" ?> 
                <section name="log4net" type="
System.Configuration.IgnoreSectionHandler" /> 
                <!-- <add key="log4net.Internal.Debug" value="true"/> --> 
                <appender name="LogFileAppender" type="
                        <file value="logs\DALTest-log-file.txt" /> 
                        <appendToFile value="true" /> 
                        <layout type="log4net.Layout.PatternLayout"> 
                                <conversionPattern value="%date [%thread] 
%-5level %logger -- %message%newline" /> 
                <appender name="ConsoleAppender" type="
                        <layout type="log4net.Layout.PatternLayout"> 
                                <conversionPattern value="%date [%thread] 
%-5level %logger -- %message%newline" /> 
                        <level value="ALL" /> 
                        <appender-ref ref="LogFileAppender" /> 
                        <appender-ref ref="ConsoleAppender" /> 
3 Code in class: 
using log4net; 
private static readonly ILog logger = LogManager

logger.Debug("Test get-customer-list begins!"); 
View raw message