Proper logging with Meteor

@arggh regarding env variables, these are no longer necessary, it was in an earlier version: all config is explicit in the application.

Regarding the logging server, the setup you describe should work, but I think it would be more efficient to have each application server receive its logs and send to a local rsyslog/syslog-ng using the SyslogSender. From there, there heavy production code from these and the File Beat on each of these servers can ship the syslog files through LogStash at whatever scale you need. I’d rather avoid a meteor app server do this kind of centralization when it can be done in pure C code by a long-time-production-quality code like rsyslog.

If you go either way, I’d be interested in the results.

Daily news: FiLog has now a complete JSdoc documentation to help use it.

1 Like

Sorry for my newbie question: I have trouble adding the package to my project. What’s the full package name besides filog that can be used in meteor add … for installation?

It’s a NPM package, so

meteor npm install --save filog

1 Like

Oh, right! It works. Thank you!

I wanted to try the filog package but I can’t install it on my Windows development platform. I get an error message when I run meteor npm install --save filog that says “Unsupported platform”.

Production environment is linux, but I of course would want to see that it works locally before deployment. Can the problem be fixed?

I need simple logging that will save server errors to a file on my production server so I can see why it’s crashing (works fine on the dev machine). Filog sounds good but I can’t figure out how to get started with it. The documentation’ is just a list of js filenames. I don’t understand from the README how to use it e.g. where would logs be stored? I must be missing something really basic about what a logger is and how it is expected to work? Thanks for any help.

filog inserts log entries into your database.

It’s just what I need but I couldn’t install it into my app on my Windows development environment as described above.

I’d be open to consider alternatives if anyone can suggest any.

Hmm, that looks potentially dangerous if your logs will be viewable in the client-side database. I’d prefer something that just saves a file on the server - and I still don’t understand how to use it from the README. I also can’t tell whether it only logs your custom messages, or all server console output.

FiLog only does so, if you configure it to do so. You can also send them to a syslog server, console etc., but you can also just extend it and do whatever you want with the logs.

For that to happen you need to have a publication setup that ships those docs to clients - nothing besides the user’s profile from your database is sent to the client by default (I hope, do check that you don’t have autopublish installed).

You can call logger.arm() to make the FiLog logger catch exceptions and log them, but if you just call console.log('cowabunga'); in your code, it’s got nothing to do with FiLog.

@arggh, thank you for the information, it sounds like Filog may be what I need. However I tried to install Filog under Linux Mint Cinnamon with the command recommended above (shouldn’t this be in the README?):

meteor npm install --save filog

But I got errors: recipe for target 'Release/' failed
make: *** [Release/] Error 127
make: Leaving directory '/home/username/Meteor/myapp/node_modules/filog/node_modules/bcrypt/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/username/.meteor/packages/meteor-tool/.1.6.0_1.f9l6vk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-53-generic
gyp ERR! command "/home/username/.meteor/packages/meteor-tool/.1.6.0_1.f9l6vk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node" "/home/username/.meteor/packages/meteor-tool/.1.6.0_1.f9l6vk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/username/Meteor/myapp/node_modules/filog/node_modules/bcrypt
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/home/username/Meteor/myapp/package.json'
npm WARN myapp No description
npm WARN myapp No repository field.
npm WARN myapp No README data
npm WARN myapp No license field.

npm ERR! errno 1
npm ERR! bcrypt@0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@0.8.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Any idea how I can install Filog?

That looks like a problem with bcrypt. Can you open an issue on the filog repository with steps to reproduce ?

Problems compiling native addons like bcrypt usually mean you’re missing one of node-gyp's dependencies, being:

  • python (v2.7 recommended, v3.x.x is not supported)
  • make; and
  • A proper C/C++ compiler toolchain, like GCC

Did a roundup and evaluation of logging libraries about 6 months ago…


@awatson1978 : did you have a chance to examine filog since then ? As the package maintainer, I’d be really interested to have feedback from someone who examined alternatives.

It should be able to log to Loggly with minimal effort, since it includes syslog, or a loggly “Sender” could be added.

This topic is a few years old, and so are several of the packages mentioned. Curious if others interested in logging for Meteor have updated recommendations with the move to async/await?

Hi @allenfuller,

what would you like to log down in your projects?
I use ostrio:logger - Packosphere with the console logger adapter. I had a quick look and the Mongo adapter probably needs very minimal touch to get it into Meteor 3 world. The insert probably needs to be asynced but that is pretty much it I think.
Meteor-logger-mongo/loggermongo.js at e4778b656f5f9e3fb70a2ca6041b6c6c34fe2346 · veliovgroup/Meteor-logger-mongo · GitHub

The errors can be wired to show in the APM too (such as Kadira or Monti).