Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Jun 24, 2015 12:52 pm 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
When a particularly long string gets printed to error.log the string gets cut off at the end and "..." is shown (without the quotes) to indicate it's been cut off.

I'm using Nginx with MySQL, PHP and Laravel if that matters. Basically when I print something to the error log like the following:

Code:
error_log(print_r($long_str, TRUE));


If $long_str is long enough it gets cut off. I'm using this for debugging purposes and this worked fine when I was working in Apache so I think it may have something to do with Nginx.

I've tried changing...

Code:
log_errors_max_len = 1024


to

Code:
log_errors_max_len = 60000


in both /etc/php5/cli/php.ini and /etc/php5/fpm/php.ini

But it didn't do anything. After googling around a bit I found:

"There is a hard-coded length limitation on the error messages in the Nginx core. It is 2048 bytes at most, including the trailing newlines and the leading timestamps. You can manually modify this limit by modifying the NGX_MAX_ERROR_STR macro definition in the src/core/ngx_log.h file in the Nginx source tree. If the message size exceeds this limit, the Nginx core will truncate the message text automatically."

I currently have Nginx already installed on my Linode. So that brings me to the question, how can I modify this src/core/ngx_log.h file, as it doesn't seem to be on my Linode, and recompile?


Top
   
PostPosted: Wed Jun 24, 2015 2:57 pm 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
You need to download the source code matching the package you are using, make the change, and then create a new set of binary packages from the modified source. Fortunately, most of the process is completely automated. On Debian/Ubuntu, it would be something like this:
Code:
sudo apt-get install build-essential fakeroot
sudo apt-get build-dep nginx
apt-get source nginx
cd nginx-1.6.2
nano src/core/ngx_log.h (make whatever change)
nano debian/changelog (write a changelog entry explaining what you did, increase version number by 0.5)
dpkg-source --commit
dpkg-buildpackage -uc -us

Then you either use "dpkg -i" to install the new packages or put them in a private repository to be installed with apt-get install.

Wish you luck.


Top
   
PostPosted: Wed Jun 24, 2015 6:50 pm 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
Thank you for the helpful reply.

I'm using Ubuntu and will be trying out what you suggested really soon. I'm assuming that I would have to shut down nginx before installing it correct? I've never done this before so I'm thinking I should back up everything before I give it a go.


Top
   
PostPosted: Wed Jun 24, 2015 7:36 pm 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
rotaercz wrote:
I'm assuming that I would have to shut down nginx before installing it correct?

No, you don't have to worry about that. The Debian packaging system does upgrades "in place" and takes care of that.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group