SmartQuant Discussion
http://www.smartquant.com/forums/

Using NLog in OpenQuant
http://www.smartquant.com/forums/viewtopic.php?f=60&t=9191
Page 1 of 1

Author:  brankov [ Tue May 24, 2011 10:40 am ]
Post subject:  Using NLog in OpenQuant

Hi

I am trying to use NLog (http://nlog-project.org) within OpenQuant to produce various log messages sent to different targets (file, console, growl, etc.). In order to use it you need to reference NLog.dll in in your VS project and to copy the NLog.config file to the folder where the executable of the VS project/application is stored.

Wiki of NLog is saying following:

Quote:
NLog attempts to automatically configure itself on startup, by looking for the configuration files in some standard places.

The following locations will be searched when executing a stand-alone *.exe application:

standard application configuration file (usually applicationname.exe.config)
applicationname.exe.nlog in application’s directory
NLog.config in application’s directory
NLog.dll.nlog in a directory where NLog.dll is located
file name pointed by the NLOG_GLOBAL_CONFIG_FILE environment variable (if defined, NLog 1.0 only - support removed in NLog 2.0)

In case of an ASP.NET application, the following files are searched:

standard web application file web.config
web.nlog located in the same directory as web.config
NLog.config in application’s directory
NLog.dll.nlog in a directory where NLog.dll is located
file name pointed by the NLOG_GLOBAL_CONFIG_FILE environment variable (if defined, NLog 1.0 only - support removed in NLog 2.0)

The .NET Compact Framework doesn’t recognize application configuration files (*.exe.config) nor environmental variables, so NLog only looks in these locations:

applicationname.exe.nlog in application’s directory
NLog.config in application’s directory
NLog.dll.nlog in a directory where NLog.dll is located


I stored my NLog.config file in different locations: /SmartQuant Ltd./OpenQuant/ (where OpenQuant.exe is stored), /SmartQuant Ltd./OpenQuant/Bin, /SmartQuant Ltd./OpenQuant/Framework/bin but it didn't work. I do not have a break in the code nor an error message. The logs are just not created. The NLog.dll is stored in /SmartQuant Ltd./OpenQuant/Bin and referenced in OpenQuant.

Does anyone has used NLog within OQ? Do you have an idea where I need to save the NLog.config file?

Many thanks,
Boris

Author:  edwardgonen [ Fri Jun 17, 2011 4:44 pm ]
Post subject:  Re: Using NLog in OpenQuant

Hi,

We use the Nlog with SQ. There should be no problem at all. Make sure your Nlog.dll and Nlog.config are in the main folder i.e. C:\program files\SmartQuant ltd\OpenQuant

Just make sure your location for log files is not protected. Try to put it first in something like C:\tmp. Sometimes you may have problems accessing such places as Program Files.

Good luck.
ed

Author:  brankov [ Fri Jun 17, 2011 4:51 pm ]
Post subject:  Re: Using NLog in OpenQuant

Thanks for replying.

In the meantime I resolved the problem and it works now also for me (cannot remember what I did wrong :roll: )

Regards,
Boris

Author:  edwardgonen [ Fri Jun 17, 2011 5:31 pm ]
Post subject:  Re: Using NLog in OpenQuant

ochen' rad :)

Happy trading
Ed

Author:  ericwang [ Tue Feb 26, 2019 12:05 pm ]
Post subject:  Re: Using NLog in OpenQuant

Hi,

Which target (https://nlog-project.org/config/?tab=targets) should I use in config file if I would like log information printed in OQ 2014 GUI Output window?

I tried "Console" and "Debugger", but not working.

Code:
<target name="debugger" xsi:type="Debugger" layout="${logger}::${message}"/>

Code:
<target xsi:type="Console"
            name="console"
            layout="${longdate}${level}${message} "
            encoding="UTF-8"
            error="false"
            detectConsoleAvailable="true" />


Meanwhile, the file target works well.

BTW, I also tried log4net. It will print all logs (everything from Debug to Fatal) to Output window, no matter how the min level configured. (But Console does work in log4net) Does anyone have the same issue?

Thanks.

edwardgonen wrote:
ochen' rad :)

Happy trading
Ed

Author:  skuvv [ Tue Feb 26, 2019 12:23 pm ]
Post subject:  Re: Using NLog in OpenQuant

ericwang wrote:
Hi,

Which target (https://nlog-project.org/config/?tab=targets) should I use in config file if I would like log information printed in OQ 2014 GUI Output window?

We have built-in writer. It can be enabled in configuration:
IsOutputLogEnabled = true
OutputLogFileName = your path

Author:  ericwang [ Wed Feb 27, 2019 4:35 pm ]
Post subject:  Re: Using NLog in OpenQuant

Thank you for your reply.

Does built-in writer or output console support log level routing (as an alternative of log4net or Nlog)?

skuvv wrote:
ericwang wrote:
Hi,

Which target (https://nlog-project.org/config/?tab=targets) should I use in config file if I would like log information printed in OQ 2014 GUI Output window?

We have built-in writer. It can be enabled in configuration:
IsOutputLogEnabled = true
OutputLogFileName = your path

Author:  skuvv [ Thu Feb 28, 2019 9:47 am ]
Post subject:  Re: Using NLog in OpenQuant

ericwang wrote:
Thank you for your reply.

Does built-in writer or output console support log level routing (as an alternative of log4net or Nlog)?


No, it writes all messages from console output.

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/