TcLog icon indicating copy to clipboard operation
TcLog copied to clipboard

First letter of Project missing when using "IncludeInstancePath"

Open chrisbeardy opened this issue 1 year ago • 2 comments

I have my logger congiured as follows:

coreLogger.MinimumLevel(LogLevels.Debug)
    .SetDelimiter('|')
    .IncludeInstancePath()
    .WriteToAds()
    .WriteToFile('C:\PLC\Logs\', 'main_log.txt')
    .TimestampFormat('YYYY-MM-DD_')
    .SetRollingInterval(RollingIntervals.Daily).DeleteLogFilesAfterDays(30);

My Project name is HB1838_PLC_Project:

image

However when logging I get the following output missing the first letter ("H"):

07/10/2024 14:24:17 121 ms | 'PlcTask' (350): B1838_PLC_Project.MAIN.machine.Zones[0].PressureDamper|Manual override activated				

chrisbeardy avatar Oct 07 '24 13:10 chrisbeardy

I've also just noticed that this behaviour only happens when using TcLogTRIG. If you just do a normal log call, you get no project name at all (which is probably the best behaviour IMO)

chrisbeardy avatar Oct 07 '24 15:10 chrisbeardy

Interesting, thanks for bringing this up. Yes, the project name should not be there at all. I deliberately implemented it to be like that as I found it would not add any relevant information. I'm a bit short of time right now, but this should be an easy fix.

bengeisler avatar Oct 07 '24 20:10 bengeisler

After some investigation, although as you can see from my screenshot, this error certainly occurred, I can no longer reproduce it and from reviewing and stepping through the code, I can't see how this happened, all the code in TcLog to do with the instance name and shortening it seems correct. I may have to put it down to some weird online change behaviour possibly in TwinCAT.

chrisbeardy avatar Oct 10 '24 11:10 chrisbeardy