Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Log files summate file size?


#1

Hi all,

I’m currently unsing Smart Inspect for logging in a Windows service. The configuration of Smart Inspect is loaded via a configuration file. The Windows Service will log 2 times a minute to the file.

When I configure the logging in a file (log.sil) and I’m using rotation Option hourly, it seems the file size is summating by each new file. Each file contains the logs for one hour.

Here’s the result (of files) and the configuration file:

[code]
; Specify the SmartInspect properties
; ======================================================
enabled = true
connections = file(filename=“log.sil”, append=true, rotate=Hourly), tcp()
level = verbose
defaultlevel = message
appname = client

; Then set the defaults for new sessions
; ======================================================
sessiondefaults.active = true
sessiondefaults.level = message
sessiondefaults.color = 0xffff7f

; And finally configure some individual sessions
; ======================================================
session.main.level = verbose
session.client.active = true
session.client.color = 0x7fffff[/code]

Any suggestions ? Help will be appreciated.

Thanks
Christian


#2

Hello Christian,

Thanks for your posting. SmartInspect creates a completely new, empty log file when it rolls over to the next log file. I would recommend opening the log files in the SmartInspect Console and checking why the log size increases. Even if the log message count stays the same, the content/body of the messages may vary and this may cause the different log file sizes.

Regards,
Tobias


#3

Hi Tobias,

Thanks for your reply. You described the behaviour I was expecting. This is why I wonder about the file sizes.

The service was running wihtout any productive actions at that night. It reads some configuration files (of another tool) and (mostly) logs to smart inspect. The second file (log-2013-08-20-17-00-00.sil) and the second to last file (log-2013-08-21-06-00-06.sil) have both 1380 entries. I can’t see any crucial differences in the files (dates changes, entries seems to be the same)…

If there isn’t any known behaviour like this, may I contact your Support via email ?

EDIT:

Ok, I compared the (2) files. First I exported them to HTML. Both files have a size of 331 KB. Using a file comparison tool, you can see many differences in dates. I couldn’t find differences that could cause that behaviour in the file size, for example:

Then I made a hex compare to the files. Now we can see there is a lot more data in the second file. Here’s the example:


Thanks and regards,
Christian


#4

Hi,

I changed the log implementation in my code.

In the first run, I only used the log string method. In Addition I used to create new sessions, when I wanted to change the color of the session (and delete the old session).

In the second run, I only use one session (SiAuto.Main), did not change the Color of the session and I’m using a lot more methods for the logging the the values. For example:
[list=]
[
]EnterMethod[/]
[
]LeaveMethod[/]
[
]LogInt[/]
[
]LogString[/]
[
]LogException[/*]
[/list]Now I’m getting the expected behaviour: The file sizes do not sum up any more

If you are interested, I can pass some code examples to you. You may like to reproduce the behaviour.

Thanks and Kind regards
Christian


#5

Hello Christian,

Thanks for the update and good to hear that it works now. Yes, some code samples would be great to get a better understanding of the differences between the first/second run.

Regards,
Tobias