Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - slogger writes non-sense messages to the log file: (12 Items)
   
slogger writes non-sense messages to the log file  
Hi, 
I am using slogger to write debugging message to a /var/log/message.

execute the command 'slogger -s 2048k -l -l /var/logs/message -f 5' at the early system up stage.

However, when I looked at the logged messages from sloginfo -t -w.

it contains very non-sense messages which human cannot understand.
ie.

GOOD LOGS:
Nov 30 23:07:24.501    5 10000     0 <compute.cpp:285> static lever arm v, 0.008, -0.133, 0.070, 0.000, 0.000, 0.000, 0.
008, -0.133, 0.070

BAD LOGS: the month is changed to Aug for some reason....
Aug 23 15:49:06.663    3 93795   1862 1635149164 1701064291 1886403122 859061792 538976288 538979360 1936619103 
1915642992 1529961768 825112113 875113504 1936619103 1915647579 828188720 774910008 690757740 1634956383 1985687901 
674246192 808986924 543454258 674246192 808659244 541339944 824788018 674244896 1936619103 1915647016 909192752 
926099756 544435830 1600416115 1949201448 909192752 926099756 544497513 1953900592 774910005 807993392 2826093 10000 
1543619244 1013213555 1952542307 1700754546 1635149164 1701064291 1886403122 859061792 538976288 538979360 1936619103 
1915642992 1530027304 758328886 909453612 544435830 1601318518 1530027304 758132273 858990892 

I thought it might be the sloginfo utility issue. Then, I wrote a stand along utility to decode slogger message by open 
/dev/slog

Now the bad logs is not numbers but it is still not making any senses

GOOD LOGS:
Jan 06 20:43:13.528  5 10000   0: <compute.cpp:231> -77.586, 5.348, 45.341, -0.005, -0.000, 0.003, 162802.148

BAD LOGS:
Sep 18 07:27:48.757  7 290669  1782: a.valid to false, (162806.585, 74597.004), head from (2) advanced to (0)
Feb 01 05:31:12.838  7 536617  514: 
Jan 01 02:46:40.758  5 133901   1: \2hf<compute.cpp:386> numOfMsgFromIin = 162759
Sep 18 07:27:48.757  7 290669  1782: a.valid to false, (162807.585, 74598.004), head from (0) advanced to (1)

I think it might be related to slogger utility.

Any one knows the issues?

Thanks in advance...
Re: slogger writes non-sense messages to the log file  
Did I post in right place? If not, please guide me where I should post it

Many thanks
Re: slogger writes non-sense messages to the log file  
Please, any one knows?

> Hi, 
> I am using slogger to write debugging message to a /var/log/message.
> 
> execute the command 'slogger -s 2048k -l -l /var/logs/message -f 5' at the 
> early system up stage.
> 
> However, when I looked at the logged messages from sloginfo -t -w.
> 
> it contains very non-sense messages which human cannot understand.
> ie.
> 
> GOOD LOGS:
> Nov 30 23:07:24.501    5 10000     0 <compute.cpp:285> static lever arm v, 0.008, -0.133, 0.070
> , 0.000, 0.000, 0.000, 0.008, -0.133, 0.070
> 
> BAD LOGS: the month is changed to Aug for some reason....
> Aug 23 15:49:06.663    3 93795   1862 1635149164 1701064291 1886403122 
> 859061792 538976288 538979360 1936619103 1915642992 1529961768 825112113 
> 875113504 1936619103 1915647579 828188720 774910008 690757740 1634956383 
> 1985687901 674246192 808986924 543454258 674246192 808659244 541339944 
> 824788018 674244896 1936619103 1915647016 909192752 926099756 544435830 
> 1600416115 1949201448 909192752 926099756 544497513 1953900592 774910005 
> 807993392 2826093 10000 1543619244 1013213555 1952542307 1700754546 1635149164
>  1701064291 1886403122 859061792 538976288 538979360 1936619103 1915642992 
> 1530027304 758328886 909453612 544435830 1601318518 1530027304 758132273 
> 858990892 
> 
> I thought it might be the sloginfo utility issue. Then, I wrote a stand along 
> utility to decode slogger message by open /dev/slog
> 
> Now the bad logs is not numbers but it is still not making any senses
> 
> GOOD LOGS:
> Jan 06 20:43:13.528  5 10000   0: <compute.cpp:231> -77.586, 5.348, 45.341, -0.005, -0.000, 0.
> 003, 162802.148
> 
> BAD LOGS:
> Sep 18 07:27:48.757  7 290669  1782: a.valid to false, (162806.585, 74597.004)
> , head from (2) advanced to (0)
> Feb 01 05:31:12.838  7 536617  514: 
> Jan 01 02:46:40.758  5 133901   1: \2hf<compute.cpp:386> numOfMsgFromIin = 162759
> Sep 18 07:27:48.757  7 290669  1782: a.valid to false, (162807.585, 74598.004)
> , head from (0) advanced to (1)
> 
> I think it might be related to slogger utility.
> 
> Any one knows the issues?
> 
> Thanks in advance...


Re: slogger writes non-sense messages to the log file  
what does the -l -l ...stands for?
Re: slogger writes non-sense messages to the log file  
and have you tried using sloginfo to read the log file as suggested in the docs?
http://www.qnx.com/developers/docs/6.6.0.update/#com.qnx.doc.neutrino.utilities/topic/s/sloginfo.html
Re: slogger writes non-sense messages to the log file  
Yes, 

I used 'sloginfo -t -w' which print messages once they arrived. the default log file is /dev/slog

I also saved to /var/log/message as 'slogger -s 2048k -l /var/logs/message -f 5' -l specify the saved raw log file. 
then, 'sloginfo -t /var/log/message' to print out the saved log message. 

They all contains some garbage logs.


> and have you tried using sloginfo to read the log file as suggested in the 
> docs?
> http://www.qnx.com/developers/docs/6.6.0.update/#com.qnx.doc.neutrino.
> utilities/topic/s/sloginfo.html


Re: slogger writes non-sense messages to the log file  
Sorry, it was a typo.

It is only one '-l'

slogger -s 2048k -l /var/logs/message -f 5

> what does the -l -l ...stands for?


Re: slogger writes non-sense messages to the log file  
seems an app is writing binary data using the wrong API. e.g. slogf() instead of slogb() ?
Re: slogger writes non-sense messages to the log file  
Peter, 
Thanks for replying..

I am using the slogf API to log the data.

You recommend to use slogb?

slogf is for formatted message. I do format the message.

Re: slogger writes non-sense messages to the log file  
Hi Chris,
the only reason I can think of is, when your application is writing binary data into the slogf().
The API for slog maintains a flag, telling the server (slogger) that the data is readably text or just binary data.
So when your Apps are writing binary data using slogf(), this garbage will be in the servers text buffers.

In general, when sending binary (raw) data, you should use the slogb() API, when sending just readable text, use slogf()
. A third API to send  just integers as an array which later can be translated when the message is read and interpreted.


Again, I think in your case, one of the formatted message contains no zero termination or garbage. I can't imagine, the 
slogger damages the messages on the server side.

Do you have the source of the app, the garbage comes from?
Re: slogger writes non-sense messages to the log file  
Hi Peter,

Thank you again for all the comments and thoughts.

You are right, to send formatted messages, use slogf().
I am sending formatted ascii txt message in my case. 
my code is:

sprintf(debugMsg, "%.3f, %.3f", distance, time);
slogf(_SLOG_SETCODE(_SLOGC_TEST, 0), _SLOG_DEBUG1, "<%s:%d> compute :%s", LOG_IDENT(id), __LINE__, debugMsg);

As you can see, this is formatted readable ASCII message. slogf is correct API to use. I am sending exactly same message
 repeat all over again. I saw the garbage messages after the program ran for 10 mins. the logging rate is in 200Hz.

I am thinking it might related to the heap memory. Because I ran slogger with 'slogger -s 256k -l /dev/shmem/log -f 7', 
-s 256k specify in-memory buffer size used which is allocated on heap. If I increase to -s 15000k, I do not see the 
garbage at all.

Thanks.

> Hi Chris,
> the only reason I can think of is, when your application is writing binary 
> data into the slogf().
> The API for slog maintains a flag, telling the server (slogger) that the data 
> is readably text or just binary data.
> So when your Apps are writing binary data using slogf(), this garbage will be 
> in the servers text buffers.
> 
> In general, when sending binary (raw) data, you should use the slogb() API, 
> when sending just readable text, use slogf(). A third API to send  just 
> integers as an array which later can be translated when the message is read 
> and interpreted.
> 
> Again, I think in your case, one of the formatted message contains no zero 
> termination or garbage. I can't imagine, the slogger damages the messages on 
> the server side.
> 
> Do you have the source of the app, the garbage comes from?


Re: slogger writes non-sense messages to the log file  
> Hi Chris,
> the only reason I can think of is, when your application is writing binary 
> data into the slogf().
> The API for slog maintains a flag, telling the server (slogger) that the data 
> is readably text or just binary data.
> So when your Apps are writing binary data using slogf(), this garbage will be 
> in the servers text buffers.
> 
> In general, when sending binary (raw) data, you should use the slogb() API, 
> when sending just readable text, use slogf(). A third API to send  just 
> integers as an array which later can be translated when the message is read 
> and interpreted.
> 
> Again, I think in your case, one of the formatted message contains no zero 
> termination or garbage. I can't imagine, the slogger damages the messages on 
> the server side.
> 
> Do you have the source of the app, the garbage comes from?

Hi Peter,

Thank you again for all the comments and thoughts.

You are right, to send formatted messages, use slogf().
I am sending formatted ascii txt message in my case. 
my code is:

sprintf(debugMsg, "%.3f, %.3f", distance, time);
slogf(_SLOG_SETCODE(_SLOGC_TEST, 0), _SLOG_DEBUG1, "<%s:%d> compute :%s", LOG_IDENT(id), __LINE__, debugMsg);

As you can see, this is formatted readable ASCII message. slogf is correct API to use. I am sending exactly same message
 repeat all over again. I saw the garbage messages after the program ran for 10 mins. the logging rate is in 200Hz.

I am thinking it might related to the heap memory. Because I ran slogger with 'slogger -s 256k -l /dev/shmem/log -f 7', 
-s 256k specify in-memory buffer size used which is allocated on heap. If I increase to -s 15000k, I do not see the 
garbage at all.

Thanks.