nlog / nlog.owin.logging Goto Github PK
View Code? Open in Web Editor NEWNLog logging adapter for OWIN
License: MIT License
NLog logging adapter for OWIN
License: MIT License
Today I used this library for the first time and I when I was reviewing the log files it generated, I found all calling methods to be "NLog.Owin.Logging.NLogFactory+Logger.WriteCore
" instead of my class methods (using ${callsite}
). Digging into the the code for NLog and this library I found out that NLog goes up the stack frame and finds the calling method, but since it does not "know" anything about your library, it assumes it is the correct one. (which is wrong in this case)
The problem gets solved by adding these 2 lines to my project, but I think it should be added to the library instead, so the end-user(developer) does not have to worry about it.
LogManager.AddHiddenAssembly(typeof(NLogFactory).Assembly);
LogManager.AddHiddenAssembly(typeof(LoggerExtensions).Assembly);
Hope it helps someone.
@pysco68 could we Drop or update/publish gh-pages branch?
Including nuget publish and badge
Should not insert EventId
-property when eventid is not assigned (Has value zero).
Also consider pre-boxing the common eventids 0-50 like this:
private static readonly object[] EventIdBoxing = Enumerable.Range(0, 50).Select(v => (object)v).ToArray();
private static object GetEventId(int eventId)
{
if (eventId >= 0 && eventId < EventIdBoxing.Length)
return EventIdBoxing[eventId];
else
return eventId;
}
File: NlogAdapter
Method: WriteCore
Why I'm getting eventId = 0 when using WriteCore method?
You passing it into method as paramter, but never using it?
Thanks for response
after .gitattributes has been changed:
rm .git/index # Remove the index to force git to
git reset # re-scan the working directory
git status # Show files that will be normalized
git add -u
git commit -m "EOL normalization"
I've installed NLog.Owin.Logging package from Nuget, added app.UseNLog();
as first line in Configuration
method in Startup
class, I've setup everything inside NLog.config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
<targets>
<target xsi:type="Database" name="Database" connectionStringName="ApplicationDbContext">
<commandText>
EXEC Add_Log @Data = @Date, @Rodzaj = @Level, @Wiadomosc = @Message;</commandText>
<parameter name="@Message" layout="${message}"/>
<parameter name="@Level" layout="${level:uppercase=true}"/>
<parameter name="@Date" layout="${date}"/>
</target>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="Database" />
</rules>
</nlog>
but my log table is empty. I've checked SQL Server Profiler and I don't see my procedure being called.
I'm using standard:
var logger = LogManager.GetCurrentClassLogger();
logger.Error("Error");
What I would like to request is simple example of how to setup and use NLog.Owin.Logging with Owin ASP site.
See other NLog repositories
Just like NLog
Created millstone for it. Proposal 2.0
https://github.com/NLog/NLog.Owin.Logging/milestone/1?closed=1
@pysco68 The build seems to be broken?
See https://ci.appveyor.com/project/nlog/nlog-owin-logging/builds/25179916
related change: NLog/NLog.Windows.Forms#40
Including badge
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.