Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I configure NLog to write to a database?
    primarykey
    data
    text
    <p>I'm trying to get NLog to write to a database, however with my current code it throws an exception when I attempt to debug, the exception is: The type initializer for 'NotifyIcon.Program' threw an exception.</p> <p>my NLog configuration file code is below, as this seems to be causing the issue as it's the only code I've changed.</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true"&gt; &lt;!-- See http://nlog-project.org/wiki/Configuration_file for information on customizing logging rules and outputs. --&gt; &lt;targets&gt; &lt;!-- add your targets here --&gt; &lt;target name="database" xsi:type="Database" /&gt; &lt;target xsi:type="Database" name="String" dbUserName="Layout" dbProvider="sqlserver" useTransactions="false" connectionStringName="String" connectionString="Data Source=AC-02\SQLEXPRESS;Initial Catalog=master;Integrated Security=True" keepConnection="true" dbDatabase="Layout" dbPassword="Layout" dbHost="Layout" installConnectionString="Layout" commandText="INSERT INTO Logs (Machine_Name, Username, Logon_Time, Screensaver_On, Screensaver_Off, Logoff_Time, Program_Start) Values @MachineName, @Username, @LogonTime, @Screensaver_On, @Screensaver_Off, @LogoffTime, @ProgramStart "/&gt; &lt;/targets&gt; &lt;rules&gt; &lt;logger name="*" minlevel="Trace" writeTo="database" /&gt; &lt;/rules&gt; &lt;/nlog&gt; </code></pre> <p>any and all help would be greatly appreciated =]</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload