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

Why do my logs look like garbage? #600

Closed
farzher opened this issue Jul 29, 2014 · 21 comments · May be fixed by hixio-mh/pm2#5 or qsays/pm2#30
Closed

Why do my logs look like garbage? #600

farzher opened this issue Jul 29, 2014 · 21 comments · May be fixed by hixio-mh/pm2#5 or qsays/pm2#30

Comments

@farzher
Copy link

farzher commented Jul 29, 2014

I installed the new release 0.9.4 and now my logs are just all arrays of numbers.

image

I'm using console.log('Current Limit:');

Also your documentation is outdated, there's no ilogs
image

@Unitech
Copy link
Owner

Unitech commented Jul 29, 2014

Hello, thanks for reporting, can you show me the logs files instead (the log file, not the output of pm2 log).

You can know logs file path by doing pm2 describe (app_name|app_id)

Thanks

@Unitech
Copy link
Owner

Unitech commented Jul 29, 2014

And did you set the option --date-log-format ?

@farzher
Copy link
Author

farzher commented Jul 29, 2014

Logs look okay.

image

I tried --date-log-format but it didn't seem to do anything. Plus the dates look fine anyway, it's only the logged content that's messed up.

@Unitech
Copy link
Owner

Unitech commented Jul 29, 2014

Did you do a pm2 updatePM2 ?

@farzher
Copy link
Author

farzher commented Jul 29, 2014

I just ran that, it's still the same array of numbers

@Unitech
Copy link
Owner

Unitech commented Jul 29, 2014

This is strange, we are on it.

Please update PM2:

npm install git://github.com/Unitech/pm2#master -g

@farzher
Copy link
Author

farzher commented Jul 29, 2014

That works, logs are back to the normal not-advanced display, thanks.

@farzher farzher closed this as completed Jul 29, 2014
@Unitech
Copy link
Owner

Unitech commented Jul 29, 2014

Great. At least, if it was working well, did you liked the new log interface ?

@enxtur
Copy link

enxtur commented Jul 30, 2014

i have a same error, looks like numbers collection, i already did this
npm install git://github.com/Unitech/pm2#master -g
pm2 updatePM2.

But still same, my pm2 version 0.9.5
Thanks

@Unitech
Copy link
Owner

Unitech commented Jul 30, 2014

Show me screenshot, log content and so on please.

@enxtur
Copy link

enxtur commented Jul 31, 2014

screen shot 2014-07-31 at 10 53 17 am

tnx your response :)

@soyuka
Copy link
Collaborator

soyuka commented Jul 31, 2014

Could you give us the line that you're logging? Is it an array?

@enxtur
Copy link

enxtur commented Aug 4, 2014

Not array. This is my test code.

function k(){
    setTimeout(function(){
          var a = {a: 'a', b: 'b'}
          console.log(a)
          k()
    }, 1000, 1000)
}
k()

should i use logging library? tnx

@soyuka
Copy link
Collaborator

soyuka commented Aug 4, 2014

capture decran 2014-08-04 a 08 03 24

Also my log file just looks fine.

@enxtur
Copy link

enxtur commented Aug 4, 2014

did you use .json file for configuration? show me your config, pls ;)

@soyuka
Copy link
Collaborator

soyuka commented Aug 4, 2014

I have just copy/paste your script and did ./bin/pm2 start logme.js.

Give me your configuration so that I get the same as you did please (:.

@enxtur
Copy link

enxtur commented Aug 5, 2014

My script did't start alone, only work with configuration.json. Maybe it is my bad

{
    "apps": [
        {
            "name": "logme",
            "script": "logme.js",
            "log-date-format": "YYYY-MM-DD HH:mm Z",
            "ignoreWatch": ["./test/*"],
            "watch": ["*"],
            "cwd": "./",
            "env": {
                "NODE_ENV": "development"
            },
            "exec_mode": "fork_mode"
        }
    ]
}

Thanks

soyuka added a commit to soyuka/pm2 that referenced this issue Aug 5, 2014
Emit the string buffer without the log format
@soyuka soyuka reopened this Aug 5, 2014
@soyuka
Copy link
Collaborator

soyuka commented Aug 5, 2014

It was an issue due to the fork buffer (from a spawned process) that isn't transformed to a string before emitting.

@enxtur
Copy link

enxtur commented Aug 5, 2014

will i update pm2 now?

@soyuka
Copy link
Collaborator

soyuka commented Aug 5, 2014

I made a PR this issue will be closed when merge ;)

You can test it by using my fork https://github.com/soyuka/pm2

@enxtur
Copy link

enxtur commented Aug 5, 2014

It works. Thank you, wish u good :)

@soyuka soyuka closed this as completed in fe795b4 Aug 5, 2014
Unitech added a commit that referenced this issue Aug 5, 2014
Fix #600, make sure that the buffer is a string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants