mathew-kurian / Scribe.js

:scroll: Node.js logging made simple! Online access to logs and more...
https://mathew-kurian.github.io/Scribe.js/
MIT License
284 stars 45 forks source link

/logs does not load any of the log json data. #50

Closed JosephScript closed 9 years ago

JosephScript commented 9 years ago

I wanted to first say that you've done some great work with this logging system! I've got it configured in my test app, and I'm writing logs to files with barely any setup. However, I'm having an issue that I was hoping you could help with.

I've got a config file set up like this:

(function (loggingConfig) {

    var scribe = require('scribe-js')();
    var passport = require('passport');

    //loggingConfig.LogWriter = new scribe.LogWriter('logger');

    loggingConfig.console = process.console;

    loggingConfig.init = function (app) {

        console.log('Configuring logging.');

        //Log each request
        app.use(scribe.express.logger());

        console.log('Adding logging panel');

        app.use('/logs', scribe.webPanel());

    };
})(module.exports);

I can see files in my logs folder, and can read the JSON inside of them. However, when I browse to the /logs page this is all I get:

image

I don't see any bugs in the console (node or browser) so I'm not sure what might be happening. Let me know what else I can do to help troubleshoot this issue!

Thanks

guillaumewuip commented 9 years ago

Hi @NukaPunk, maybe the console object is not pointing to the process.console. Can you try something like below ?

loggingConfig.console = process.console;
var console = logging.console;

console.log('This should be a Console2 message');
JosephScript commented 9 years ago

Thanks for the quick reply!

Yup that's exactly what I'm doing. Above you can see the line loggingConfig.console = process.console; and then when I include the module (let's say logging.js) I do the following:

var log = require('./logging');
log.console.error('This should be a Console2 message');

It logs to the console just fine, and the files just fine too. But the browser doesn't display them at all.

Are perhaps any permissions I have to set on the folder? I know scribe makes the folders itself so I didn't assume so.

Thanks again!

guillaumewuip commented 9 years ago

Ok, I first thought it was the console.log you used in your module that doesn't work. I don't think it's a permission error, as you can see that scribe has when written to disk. Using your browser developers tools, do you see any failed request ? Are you on Windows ?

JosephScript commented 9 years ago

Nope not a thing. Do you want me to post the markup of the page or anything to help? I could try throwing some break points in the Angular files and see what's going on.

mathew-kurian commented 9 years ago

Hey Joseph, Can you post a dump/screenshot of all the network requests by the browser? Review the responses as well. Just to make sure the data is reaching the browser. On Jun 23, 2015 5:22 AM, "Joseph A. Szczesniak" notifications@github.com wrote:

Nope not a thing. Do you want me to post the markup of the page or anything to help? I could try throwing some break points in the Angular files and see what's going on.

— Reply to this email directly or view it on GitHub https://github.com/bluejamesbond/Scribe.js/issues/50#issuecomment-114472657 .

JosephScript commented 9 years ago

Looks like it's working now! I was in-fact a local permissions issue. Thanks guys.

Quick question: How do you view the error logs specifically? When I load the panel I see "Logs" and then all of the dates, and then just all of the request logs. But not any of the errors I logged using the method above. Ideas?

mathew-kurian commented 9 years ago

Also look at the logs folder in your root directory of your node app. Let us know what you see. Thanks On Jun 23, 2015 5:35 AM, "Mathew Kurian" bluejamesbond@gmail.com wrote:

Hey Joseph, Can you post a dump/screenshot of all the network requests by the browser? Review the responses as well. Just to make sure the data is reaching the browser. On Jun 23, 2015 5:22 AM, "Joseph A. Szczesniak" notifications@github.com wrote:

Nope not a thing. Do you want me to post the markup of the page or anything to help? I could try throwing some break points in the Angular files and see what's going on.

— Reply to this email directly or view it on GitHub https://github.com/bluejamesbond/Scribe.js/issues/50#issuecomment-114472657 .

JosephScript commented 9 years ago

Yup all of the log files are there, of each level (error, info, etc) for each day.

JosephScript commented 9 years ago

Got it figured out guys. Thanks for the help! What an awesome project!

JosephScript commented 9 years ago

I just wanted to note that I'm going to suggest this to all of my students :+1:

mathew-kurian commented 9 years ago

I'm glad it all worked out and thank you. We appreciate that. On Jun 23, 2015 8:42 AM, "Joseph A. Szczesniak" notifications@github.com wrote:

I just wanted to note that I'm going to suggest this to all of my students [image: :+1:]

— Reply to this email directly or view it on GitHub https://github.com/bluejamesbond/Scribe.js/issues/50#issuecomment-114550879 .