Improved Emonhub log view in Emoncms

A small but hopefully useful improvement to the EmonHub log view interface in emoncms.

When you open the log view window it starts by loading just over 100 lines. As you keep the view open rather than refreshing and reloading a moving window of 100 lines the log now appends only new log content in an ever expanding way so that it’s much easier to monitor and scroll back through the recent history.

If you scroll up to view content higher up it automatically stops auto scrolling to the latest line. When you scroll back down again it re-engages auto scroll.

Latest version is v2.1.2


Excellent. Have you fixed the update log disappearing?

Perhaps a similar format so easier to review after an update :slight_smile:

Not yet, yes will copy this approach across. I did fix the change of log level in the emonhub log - though I think it might be more useful if that was just a filter of the present view rather than changing the actual log level in emonhub.conf.

The other consideration is how much of the emonhub.log should be loaded when you open the page. I have it set to 10kb at the moment but that could easily be extended to load say 500kb or perhaps even more?

Yes, definitely

User definable?

Ok I will make that change.

True though complicates implementation… the full log can be downloaded on the page already…

I’d leave as is then.

How about being able to download the rotated logs as well?

I’m not sure this is working correctly as other than emonhub restart log messages, I’m not getting anything else logged regardless of log level.

Hi @TrystanLea ,

I’m not shure if it is directly connected to this, but after upgrading from emoncms 11.0.3 or so, emonhub could not start. I found in the journalctl: error: argument --logfile: can't open '/var/log/emonhub/emonhub.log': [Errno 13] Permission denied...

The logfile was previously owned by emonhub, but I saw in the emonhub.service that the service is now run by user pi. So after chown pi: /var/log/emonhub/emonhub.log emonhub could start and everything was fine.

Is it on purpose that pi is the new user to start this service?

Hello @Thelmike I’ve just pushed a fix for the emonhub issue a few minutes ago, could you run a full update to see if that clears the issue for you?

After Full update emonhub started fine and worked as expected.

BTW, it’s a pitty that the Upgrade logging shown at the bottom is immediately closing after all update steps. Couldn’t it not better be left visible ‘for a while’/until refresh?

1 Like

Thanks @Thelmike good to hear

yes that’s on the list to look at

1 Like

If you go to a different page, then go back you can then download the log (as an interim fix).

@borpin, thanks for that!