473,324 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Getting log4net to work *just* the way I want it to ! (hard)

Folks,

I'd really like to use log4net for our error logging, but I'm having
two problems:

1) For certain cases, I'd like to log error and messages to text
files. I tried both the regular FileAppender, as well as the
RollingFileAppender, but both don't work exactly the way I'd like them
to.

What I'd like to achieve is logging into a file that I can specify the
file name format of: something like <prefix>-<date in my own custom
format>.log.

With the rolling file appender, I *almost* get it, but when I specify
"DateFormat=YYYYMMDD", then what I end up with are files such as
mylog_2006-09-01.log
mylog_2006-09-01.log2006-09-02
mylog_2006-09-01.log2006-09-03
and so on. *NOT* what I wanted, really ! I want the date string to be
in the NAME of the file, and *NOT* just appended to the extension of
the file. Because this way, I can't get all the files by specifying a
"*.log" dir mask......

Also, another trouble is that Windows services seem to "hold on" to
their log file, and when I start a Windows service on Sept 1th, 2006,
it will log into Service_2006-09-01.log and then lock that, and even
if more messages come in on the 2nd and 3rd of September, those will
still be written into the 2006-09-01.log file.

So my two main complaints / questions are:

* How do I tell log4net to format the file name according to
*MY* choice?
mylog_YYYY-MM-DD.log and nothing else

* How do I get Windows Services to "switch" to a new log file,
if a message appears
on Sept 2nd and use service_2006-09-02.log instead of
writing all into the file for Sept 1st?

2) The AdoNetAppender doesn't seem to work - period. What the hell is
up with that??

* I have a suitable table (I think) for the messages
* I configured the AdoNetAppender for *ALL* messages from the
root level down
* I specified the insert statement and the fields collection
in the log4net.config

Still, it just doesn't seem to log ANYTHING at all..... the
RollingFileAppender works just fine......

Any ideas??

Thanks!
Marc
Sep 4 '06 #1
0 1059

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: SK | last post by:
Hi, I am using log4net in my c# application.Want to know how to customize the log output format. I know that it can be done using LayoutSkeleton class,but dont know what other parameters to be...
3
by: SK | last post by:
Hi, I am using log4net in my c# application.Want to know how to customize the log output format. I know that it can be done using LayoutSkeleton class,but dont know what other parameters to be...
2
by: Marc Scheuner | last post by:
Folks, I'd really like to use log4net for our error logging, but I'm having two problems: 1) For certain cases, I'd like to log error and messages to text files. I tried both the regular...
2
by: forest demon | last post by:
I need to be able to create an appender to direct output to a MessageBox. The API does not have a MessageBox appender like nLog does. What would be the easiest way to do this. The examples...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.