Все вопросы: [log4net]

234 вопросов

2
голосов
2ответов
1581 просмотров

Stuck trying to get Log4Net to work with Dependency Injection

I've got a simple winform test app i'm using to try some Log4Net Dependency Injection stuff. I've made a simple interface in my Services project :- public interface ILogging { void Debug(string message); // snip the other's. } Then my concrete type will be using Log4Net... public cl...

1
голосов
3ответов
1137 просмотров

Change app.config at runtime

I'm currently trying to create the app.config at runtime. The basic idea is that I'm deploying several config files and based on an environment variable the application itself decides which one to use. Currently I'm copying the config file I'd like to use to myapp.exe.config, and refresh all the...

1
голосов
1ответов
1512 просмотров

Log4net .Does it work in vb6 Interop to .net?

I have some legacy application in vb6 and I am interoping into .net It all works fine in net alone but in vb6 it does not create the log. I cannot see what I am doing wrong. I have using log4net using config file and I have added the log4net configsection into C:\Program Files\Microsoft Visual ...

75
голосов
11ответов
89449 просмотров

How can I change the file location programmatically?

I am totally new to Log4net. I have managed to get something going by adding a config file and simple logging. I have hardcoded the value to be "C:\temp\log.txt" but this is not good enough. The logs must go to the special folders path = Environment.GetFolderPath(Environment.SpecialFolder.C...

0
голосов
1ответов
328 просмотров

How to configure a child logger with a lower loglevel than the root level in Log4net

The app I'm working on uses a library that generates a lot of INFO level messages I don't want to log. But the rest of the app and libraries produce INFO level messages I need to log. How can I setup log4net so that all INFO messages are logged except for one logger that need to log only at WAR...

2
голосов
1ответов
2537 просмотров

How to get log4net to generate log files when running as non-administrator user?

A process running as a non-administrator user does not have rights to write to the program files folder. What is the best way to configure log4net to write to a location that a non-administrator user has rights to? Ideally there would be: A single configuration file or configuration from code...

1
голосов
2ответов
3971 просмотров

Can This Simple Log4Net Wrapper Be Improved?

I have written a simple log4net wrapper. I was wondering whether this wrapper code could be improved. I am little bit worried about the reflection code thrown in into each Logging Function (Info, Warn etc) to get the Calling function name. Whether there could be any possible performance problem...

23
голосов
4ответов
26473 просмотров

Programmatically adding and removing log appenders in log4net

I have a component that uses log4net. I want to create unit tests, that validate that certain error conditions result in the correct logging. I was thinking that the best way to do this is to create an ILogAppender implementation, for example a mock. I would then add the log appender to log4net ...

8
голосов
4ответов
23332 просмотров

Multithread safe logging

We have an application that runs in multiple threads and uses Log4Net as logging framework. We encountered a scenario where some log events weren't logged. As mentioned in the docs, the FileAppender and the other Appenders are "not safe for multithreaded operations". I searched the web for solut...

1
голосов
4ответов
1022 просмотров

Logging across multiple web servers

I would like to know how people dealing with logging across multiple web servers. E.g. Assume there are 2 webservers and some events during the users session are serviced from one, some from the other. How would you go about logging events from the session coherently in one place (without e.g.c...

3
голосов
2ответов
5098 просмотров

How can I enable logging for an NServiceBus Generic Host

I didn't want to make the title too long but this question specifically refers to running an NServiceBus Generic Host as a Windows Service (thanks to TopShelf) configured to run as Local System (on a Vista machine) In a previous question I explain why I decided to adapt the PubSub sample to run ...

7
голосов
2ответов
8693 просмотров

How can I get the log filename through code?

How can I get the log filename in code? (So I can print it to the console) My log file is define like this in app.config: <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="logfile" /> ...

1
голосов
3ответов
428 просмотров

log4net and mailing

I need to modify the existing program that does some error logging by writing to an access file and it actually uses log4net dll (as we found out by checking the dlls via hex editor) so in idea I will need to recompile the tweaked dll with the original that program uses. The need is pretty simple...

0
голосов
2ответов
1846 просмотров

Changing log4net FileAppender whilst logging

We're trying to configure a server process so that, each time it receives a request, it logs that request to a NEW filename. The process is generally single threaded but we cannot guarantee that no other thread somewhere in the code won't sometimes try to write something to log4net. What seemed...

51
голосов
7ответов
18882 просмотров

Disable NHibernate logging

I have an empty app.config file, but I still get NHibernate debug logs NHibernate: SELECT this_.LogID as LogID71_0_, this_.Level as Level71_0_, this_.Message as Message71_0_, this_.EventTime as EventTime71_0_, this_.Component as ... I tried adding a log4net configuration with an ERROR log leve...

0
голосов
1ответов
4427 просмотров

Log4Net Dynamic Filename not working

Possible Duplicate: log4net file names based on GlobalContext properties This is really starting to bother me. I'm just simple trying to add a property variable to a log4Net filename. Can anobdy see anything I'm doing wrong??? Here's the config... <appender name="logger1" type="l...

0
голосов
2ответов
643 просмотров

Looking for Log4net compatible for .net 1.1 (1.14322)

I have been asked to add some logging to a legacy application using .net 1.1 and told to use Log4net ,can somebody tell me as I could not find out where I can find the download compatible with .net 1.1 (1.14322)

0
голосов
2ответов
117 просмотров

Log4Net doesn't log from one machine, but from others with same config

I have a c# assembly exe with a log4net xml config. the exe and config is sitting on a network drive. execution and logging from 2 machines is ok. from a third machine, no logging at all occurs. any ideas?

17
голосов
3ответов
16290 просмотров

Enable file logging for log4net from code instead of from configuration

Why in the world does the following test fail? (its in xunit) I've tried it with different appenders and it never writes anything though the log seems like it is ready to write. I eventually created my own appender just to test it. public class TestAppender : AppenderSkeleton { pub...

11
голосов
2ответов
6116 просмотров

Is there a log4net version for Silverlight?

Is there a log4net version built against Silverlight somewhere? Failing that, can someone suggest an alternative logging framework to use in Silverlight?

2
голосов
1ответов
1172 просмотров

Suppressing internal log4net error messages

I have a console application that should do best effort logging to a database in addition to flat files. When there is no network connectivity (and therefore no connection to the database) log4net prints an error. log4net:ERROR [AdoNetAppender] Could not open database connection [Data Source=......

2
голосов
1ответов
1404 просмотров

Programmatically configuring log4net to write the same messages to two separate files

Right now, I'm programmatically configuring log4net by creating a RollingFileAppender instance then calling BasicConfigurator.Configure(). This is working great, but I'm trying to create two identical files - one in a timestamped directory that gets created for every run of the app, another in a ...

1
голосов
3ответов
4226 просмотров

log4net - logging for a dll called via COM interop

I've written a .NET DLL which is called from another application using COM interop. I'd like to use log4net, but I need to specify the location of the log file at runtime from the other application. I've always used log4net in the simplest possible way for WinForms project, but since a DLL proj...

34
голосов
3ответов
14133 просмотров

Why isn't there a trace level in log4Net?

I was just wondering why there isn't a trace level in log4Net. This level seems to be missing and I sometimes feel the need to use it, for example to output what events are being executed in an application. This feature is a part of log4J. I know I can create a custom level like is talked about...

43
голосов
3ответов
24549 просмотров

Configure log4net to send errors to different appenders based on level

I want to send Info Level & above to the XML appender and Error/Fatal Level to the EventLog appender. I gather that I need to modify the root element of the config but I'm struggling with the syntax. What is the configuration syntax to direct logs to the correct appender for a given level or...

130
голосов
5ответов
105548 просмотров

Configure Log4net to write to multiple files

I'd like to write log to 2 different log files from the same process. is that possible thing to do using log4net? I'll need to write separate messages to each log file. how can I write a message to a specific appender?

29
голосов
5ответов
27290 просмотров

log4net log all unhandled application errors

Can you point me to some tutorial or samples on how I can log all un-handled exceptions that are occurring on my mvc web app using log4net. Thank you

2
голосов
2ответов
1538 просмотров

Class project is not loading log4net.config from Main project

I have my log4net Wrapper and log4net dll in its own class project and i have added the following to assemblyinfo.cs of the class project // log4net config file [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)] So my main project has the log4net.config fil...

0
голосов
1ответов
1120 просмотров

Now Log4Net.config isn't being loaded as I moved my wrapper class to its own class project

Can anyone help, i have been using log4net with success i basically had a static class (wrapper) in my webproject and i load my config from external file called log4net.config by adding this in assemblyinfo.cs // log4net config file [assembly: log4net.Config.XmlConfigurator(ConfigFile = ...

65
голосов
7ответов
48890 просмотров

Get log4net log file in C#

This is my configuration for log4net: <log4net> <appender name="MyLogger" type="log4net.Appender.RollingFileAppender"> <file value="MyLog.log" /> <appendToFile value="true" /> <rollingStyle value="Size"/> <maxSizeRollBackups v...