I have code which can error with russian language message.
For example:
Неверно составлен limit
But error.log contains:
\xd0\x9d\xd0\xb5\xd0\xb2\xd0\xb5\xd1\x80\xd0\xbd\xd0\xbe \xd1\x81\xd0\xbe\xd1\x81\xd1\x82\xd0\xb0\xd0\xb2\xd0\xbb\xd0\xb5\xd0\xbd limit
Is there way to read with tailf error.log normally (with sed
or something)?
Or how I can "tell" to apache do not encode utf symbols error.log?
On a Linux server, you can access Apache error logs from var/log/apache2/error. log. You can then log out the errors from the error log file by writing the following command: sudo tail -f /var/log/apache2/error.
Apache errors can be found in this directory /usr/local/apache/logs/error_log. All the Apache errors are logged in the error_log.
Basically, the difference is in the names. Access logs is everything, so everyone, every time somebody or something has accessed the website. Error logs just record the same information but only for error pages.
If you are troubleshooting a Debian or Ubuntu derived system, examine /var/log/apache2/error. log for errors using a tool like tail or less . For example, to view the last two lines of the error log using tail , run the following command: sudo tail -n 2 /var/log/apache2/error.
After couple tries I found the solution.
echo -e
-- to get utf insead of hex.
tailf ... | while read line; do command; done;
-- to read output of tailf by line
read -r
-- to avoid of convert escape sequence.
So, result is:
tailf /var/log/apache2/error.log | while read -r line; do echo -e "$line"; done;
I think you might need to use enca in your case, and if you don't know exactly what type of output encoding you have you might also use the options available in it such as -g, --guess
you can have it from gitorious.
a simple description, and I'm paraphrasing here:
If you are lucky enough, the only two things you will ever need to know are: command
enca FILE
and to know what type of encoding your file uses you can try:
enconv FILE
obviously you will need to replace FILE with your error log. after that you can simply try something like:
tail -20f /path/to/your/file/error_log
to download your file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With