Giter Site home page Giter Site logo

Comments (5)

Viktar-Tserashchuk avatar Viktar-Tserashchuk commented on August 15, 2024

Hi @derMaaster,

We use NLog to log FixAntenna operations. You could create an NLog config and put it in the folder with Antenna to receive more information about what is going on.

Here is an example of the config from our repo:
https://github.com/epam/fix-antenna-net-core/blob/main/FixAntenna/NetCore/NLog.config
It will log to the console.

Here is the NLog documentation you can use to configure logging into a file:
https://github.com/nlog/NLog/wiki/File-target

from fix-antenna-net-core.

derMaaster avatar derMaaster commented on August 15, 2024

Thanks @Viktar-Tserashchuk , please confirm - FixAntenna has NLog "built in" and that is its logging functionality, and when I put NLog.config into the same base folder as say fixengine.properties, that will overwrite the basic settings of FixAntenna's logging ? (if I am using the nuget package...)

from fix-antenna-net-core.

derMaaster avatar derMaaster commented on August 15, 2024

When I move from the nuget packge to referencing Epam.FixAntenna.NetCore.csproj and change the NLog file there to:

`

<variable name="conLayout" value="[${date:format=yyyy-MM-dd HH\:mm\:ss.fff}] [${level:uppercase=true:padding=5}] [${threadname}] [${logger:shortName=true}]: ${message} ${exception:innerFormat=Message,StackTrace}"/>

<targets>
	<target name="logFile" xsi:type="File"
		layout="${conLayout}" 
		fileName="${basedir}/logs/logfile.txt" 
		keepFileOpen="true"
		encoding="utf-8" />
</targets>

<rules>
	<logger name="Ridd*" minlevel="Trace" maxlevel="Debug" writeTo="logFile" final="true" />
</rules>

`

I dont get different output in appl/logs/ ...

Tried NLog's simple example too:

`

<targets>
    <target name="file" xsi:type="File"
        layout="${longdate} ${logger} ${message}${exception:format=ToString}" 
        fileName="${basedir}/logs/logfile.txt" 
        keepFileOpen="true"
        encoding="utf-8" />
</targets>

<rules>
    <logger name="*" minlevel="Debug" writeTo="file" />
</rules>

`

from fix-antenna-net-core.

Viktar-Tserashchuk avatar Viktar-Tserashchuk commented on August 15, 2024

I would put nlog.config into the folder with your binary files. FixAntenna uses it only for the engine logs.
.in/.out files are not affected by any changes in nlog.config.

Your config file will work if you surround it with proper tags:

<?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">

...

</nlog>

and change <logger name="Ridd*" to be <logger name="*"

Also, it's better to skip setting maxlevel="Debug" as it excludes the info level messages.

The full config that worked for me looks like this:

<?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">

    <variable name="conLayout" value="[${date:format=yyyy-MM-dd HH\:mm\:ss.fff}] [${level:uppercase=true:padding=5}] [${threadname}] [${logger:shortName=true}]: ${message} ${exception:innerFormat=Message,StackTrace}"/>

    <targets>
        <target name="logFile" xsi:type="File"
            layout="${conLayout}" 
            fileName="${basedir}/logs/logfile.txt" 
            keepFileOpen="true"
            encoding="utf-8" />
    </targets>

    <rules>
        <logger name="*" minlevel="Trace" writeTo="logFile" final="true" />
    </rules>

</nlog>

from fix-antenna-net-core.

derMaaster avatar derMaaster commented on August 15, 2024

Thanks @Viktar-Tserashchuk

I did have proper tags, I just did not post those with the rest of the example - apologies for the confusion. Turns out I had the base directory wrong - the debug files were there, with the binaries.

Once again - I appreciate the support and help you guys provide.

from fix-antenna-net-core.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.