forked fromsaleem-mirza/serilog-sinks-mysql
- Notifications
You must be signed in to change notification settings - Fork1
Serilog sink that writes to MySQL database.
License
NotificationsYou must be signed in to change notification settings
mysql-net/serilog-sinks-mysql
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Serilog sink that writes to MySQL database.
InstallSerilog.Sinks.MySQL from NuGet
Install-Package Serilog.Sinks.MySQLConfigure logger by calling WriteTo.MySQL
varlogger=newLoggerConfiguration().WriteTo.MySQL("server=127.0.0.1;uid=user;pwd=password;database=diagnostics;").CreateLogger();logger.Information("This informational message will be written to MySQL database");
To use the rolling file sink with theSerilog.Settings.AppSettings package, first install that package if you haven't already done so:
Install-Package Serilog.Settings.AppSettingsIn your code, callReadFrom.AppSettings()
varlogger=newLoggerConfiguration().ReadFrom.AppSettings().CreateLogger();
In your application's App.config or Web.config file, specify the MySQL sink assembly and requiredconnectionString under the<appSettings> node:
<appSettings> <addkey="serilog:using:MySQL"value="Serilog.Sinks.MySQL"/> <addkey="serilog:write-to:MySQL.connectionString"value="..."/> <addkey="serilog:write-to:MySQL.tableName"value="Logs"/> <addkey="serilog:write-to:MySQL.storeTimestampInUtc"value="true"/></appSettings>
Sink buffers log messages internally and flush to MySQL database in batches using available hardware threads.
About
Serilog sink that writes to MySQL database.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Languages
- C#96.8%
- PowerShell3.2%