I was having the same problem.

I entered the data with milliseconds into sql server directly and it worked
fine.
(As it should - the datetime datatype is valid within 3.3 milliseconds)

That told me is was NOT a SQL issue.

I changed the ,fff to .fff and it worked fine.

<parameter>
        <parameterName value="@log_date" />
        <dbType value="DateTime" />
        <layout type="log4net.Layout.PatternLayout" value="%date{yyyy-MM-dd
HH:mm:ss.fff}" />
</parameter>

When I checked the database (SQL Express 2005) the milliseconds were not
there.
I had to do a convert on the date column to see the millisecs.  This also
happened
when I entered the data directly.

Hope this helps.


Peter A. Kirk wrote:
> 
> Hi there
> 
> I have a couple of questions regarding AdoNetAppender, which I am using
> to log to a SQL Server database.
> 
> 
> (1)
> Can someone explain the use of the "date-time" parameter? For example, I
> try this:
> 
> <parameter>
>   <parameterName value="@log_date" />
>   <dbType value="DateTime" />
>   <layout type="log4net.Layout.PatternLayout" value="%date{yyyy-MM-dd
> HH:mm:ss,fff}" />
> </parameter>
> 
> But I get no output. If I remove the fff then I do get log output, but
> no milliseconds. Is it because SQL Server cannot save milliseconds?
> Also, what is the format actually for - SQL Server shows the date/time
> in its own format, nothing to do with what I specify?
> 
> 
> 
> (2)
> How do ensure the "order" of the log outputs in the database table? I
> mean if I just select from the log table how do I know what order the
> log output was written to the table? Can log4net auto-generate an
> incrementing id (I think I did see this mentioned somewhere, but now I
> can't find the link again...)? Or is there another way?
> 
> 
> Thanks,
> Peter
> 
> 

-- 
View this message in context: 
http://www.nabble.com/AdoNetAppender-questions-tf1524271.html#a6412539
Sent from the Log4net - Users mailing list archive at Nabble.com.

Reply via email to