Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Error Reporting of Errors in User/Common Code #43

Closed
krkeegan opened this issue Jan 22, 2013 · 3 comments
Closed

Better Error Reporting of Errors in User/Common Code #43

krkeegan opened this issue Jan 22, 2013 · 3 comments

Comments

@krkeegan
Copy link
Collaborator

Currently, if a user uses the "reload user code" command and there is an error in one of the user code files the user is only notified of the error in the console output. There is no option to enable logging of the error.

All of this is buried deep within the main mh perl file. Notably, the eval_user_code_load handles a lot of the error reporting to the console with a series of simple print commands.

Optionally sending these errors to a log seems like a good idea. This should probably be in addition to sending the errors to console.

As a side note, is anything other than a "Restart" ever sent to the error_log?

@marcmerlin
Copy link
Collaborator

On Tue, Jan 22, 2013 at 11:38:04AM -0800, krkeegan wrote:

As a side note, is anything other than a "Restart" ever sent to the error_log?

Sure thing:

20/01/2013 22:51:39 ---------- Restart ----------
Sunday, 20/01/2013 22:51 :
Error found in user code file: /var/local/src/misterhouse/data/mh_temp.user_code (error_count 1)

20/01/2013 22:51:45 : 20/01/2013 22:51:45 : Omnistat[2]->send_cmd did not get expected first byte (0x82) in ack reply to command 02 20 48 01 6b (got 0x06 in 0x06 0x22 0x48 0x01 0xed ) at ../lib/Omnistat.pm line 498.

20/01/2013 23:10:53 ---------- Restart ----------

10/01/2013 05:02:38 ---------- Restart ----------
Thursday, 10/01/2013 09:27 :
Error found in user code file: /var/local/src/misterhouse/data/mh_temp.user_code (error_count 1)

10/01/2013 09:27:00 : Could not get TempOutdoorCrawlspace temp at (eval 850) line 7190.
Line 7185: $Weather{$weather_var} = $var;
Line 7186: print "Weather: set $weather_var to $var\n";
Line 7187: }
Line 7188: else
Line 7189: {
Line 7190: die "Could not get $weather_var temp";
Line 7191: }
Line 7192: }
Line 7193: # Warning TempOutdoor will get reset by 'Getting the current weather for MOFFETT ARPT, CA'
Line 7194: $Weather{TempOutdoor} = $Weather{TempOutdoorCrawlspace};
Line 7195: #$Weather{TempFMR} = 32 + 1.8 * $oregon_fmrtemp->state;

10/01/2013 09:33:14 ---------- Restart ----------

"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/

@krkeegan
Copy link
Collaborator Author

Marc,

It looks like you have Stdout and possible Stderr set to output to the
error.log in your startup script maybe?? Something like:

mhl 2>&1 >> data/logs/error.log

I otherwise can't find how this would be written.

On Tue, Jan 22, 2013 at 12:48 PM, Marc MERLIN notifications@github.comwrote:

On Tue, Jan 22, 2013 at 11:38:04AM -0800, krkeegan wrote:

As a side note, is anything other than a "Restart" ever sent to the
error_log?

Sure thing:

20/01/2013 22:51:39 ---------- Restart ----------
Sunday, 20/01/2013 22:51 :
Error found in user code file:
/var/local/src/misterhouse/data/mh_temp.user_code (error_count 1)

20/01/2013 22:51:45 : 20/01/2013 22:51:45 : Omnistat[2]->send_cmd did not
get expected first byte (0x82) in ack reply to command 02 20 48 01 6b (got
0x06 in 0x06 0x22 0x48 0x01 0xed ) at ../lib/Omnistat.pm line 498.

20/01/2013 23:10:53 ---------- Restart ----------

10/01/2013 05:02:38 ---------- Restart ----------
Thursday, 10/01/2013 09:27 :
Error found in user code file:
/var/local/src/misterhouse/data/mh_temp.user_code (error_count 1)

10/01/2013 09:27:00 : Could not get TempOutdoorCrawlspace temp at (eval
850) line 7190.
Line 7185: $Weather{$weather_var} = $var;
Line 7186: print "Weather: set $weather_var to $var\n";
Line 7187: }
Line 7188: else
Line 7189: {
Line 7190: die "Could not get $weather_var temp";
Line 7191: }
Line 7192: }
Line 7193: # Warning TempOutdoor will get reset by 'Getting the current
weather for MOFFETT ARPT, CA'
Line 7194: $Weather{TempOutdoor} = $Weather{TempOutdoorCrawlspace};
Line 7195: #$Weather{TempFMR} = 32 + 1.8 * $oregon_fmrtemp->state;

10/01/2013 09:33:14 ---------- Restart ----------

"A mouse is a device used to point at the xterm you want to type in" -
A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/


Reply to this email directly or view it on GitHubhttps://github.com//issues/43#issuecomment-12565522.

@marcmerlin
Copy link
Collaborator

On Tue, Jan 22, 2013 at 01:01:25PM -0800, krkeegan wrote:

Marc,

It looks like you have Stdout and possible Stderr set to output to the
error.log in your startup script maybe?? Something like:

mhl 2>&1 >> data/logs/error.log

I otherwise can't find how this would be written.

I run
cd ~mh/bin; ./mh -tk 0

No special trickery, it just works for me.

Marc

"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants