[erlang-questions] Appearance of carriage return in a erlang.log on UNIX

Jay Doane <>
Wed Mar 13 02:53:49 CET 2013


While this doesn't really fix the problem, if you are using emacs, it may
help you ignore it ;)

(defun remove-dos-eol ()
  "Do not show ^M in files containing mixed UNIX and DOS line endings."
  (interactive)
  (setq buffer-display-table (make-display-table))
  (aset buffer-display-table ?\^M []))
(add-hook 'log-view-mode-hook 'remove-dos-eol)
(add-to-list 'auto-mode-alist '("\\.[0-9]+\\'" . log-view-mode))



On Tue, Mar 12, 2013 at 3:44 PM, Erik Søe Sørensen <>wrote:

> Hey now - why has Gmail begun eating my emails? I didn't even know it had
> happened before Tom wrote.
>
> Anyway, I found the reason - it is the module 'standard_error' which is
> responsible, and it inserts the \r when a) you write to stderr and b)
> Erlang thinks it is connected to a terminal.
>
> Hoping this helps, or at least illuminates. My original mail contained
> some demoing of when the conversion is active, but I won't try to write the
> command lines involved from this phone.
>
> /Erik
> Den 12/03/2013 21.51 skrev "Tom Burdick" <>:
>
> Erlang always seems to stuff carriage returns in its stdio output. Its
>> really really annoying when using it with ports or... well anything.
>>
>> I actually spent the time trying to hunt down where in the OTP those are
>> being put in there so I could send a patch or keep a \r free version of
>> erlang around for myself.
>>
>> I gave up after an hour of trying to hunt it down, maybe someone more
>> knowledgable can point us all in the right place?
>>
>> Tom
>>
>>
>> On Mon, Mar 11, 2013 at 2:40 AM, Jay Doane <> wrote:
>>
>>> I believe the erlang.log.N files come from
>>> http://www.erlang.org/doc/man/run_erl.html, which is probably being
>>> invoked from the script rebar generated in rel/files.
>>>
>>> There are several environment variables you can use to control the
>>> output, but I don't know how to get rid of those annoying carriage returns.
>>>  Sure wish I did...
>>>
>>> Jay
>>>
>>>
>>> On Sun, Mar 10, 2013 at 12:48 PM, Valentin Kuznetsov <>wrote:
>>>
>>>> Hmm,
>>>> the application does use error_logger and the erlang.log.1 file
>>>> contains proper lines from the logger, e.g.
>>>>
>>>> =INFO REPORT==== 9-Mar-2013::20:55:05 ===^M
>>>> <0.818.0> Listening on 10190.^M
>>>> Eshell V5.9.3  (abort with ^G)^M
>>>> ()1> ^M
>>>> =INFO REPORT==== 9-Mar-2013::20:55:31 ===^M
>>>> <0.838.0> Client {127,0,0,1} connected.^M
>>>>
>>>> The release log area has the following content:
>>>>
>>>> erlang.log.1  run_erl.log  sasl  sasl-error.log
>>>>
>>>> The sasl-error.log contains proper content too, e.g.
>>>>
>>>> =SUPERVISOR REPORT==== 10-Mar-2013::18:29:44 ===
>>>>      Supervisor: {local,ssl_connection_sup}
>>>>      Context:    child_terminated
>>>>      Reason:     ekeyfile
>>>>      Offender:   [{pid,<0.1016.0>},
>>>>                   {name,undefined},
>>>>  {mfargs,{ssl_connection,start_link,undefined}},
>>>>                   {restart_type,temporary},
>>>>                   {shutdown,4000},                  {child_type,worker}]
>>>>
>>>> but it does not have '\r' symbols.
>>>>
>>>> The erlang.log.1 is not yet rotated since I only perform a few actions
>>>> with my application.
>>>>
>>>> On Mar 10, 2013, at ,Mar 10, 3:29 PM, Antoine Koener wrote:
>>>>
>>>> Erlang doesn't have a clue about your .1 file.
>>>> See more about your log rotation program.
>>>> Also your log file doesn't look like a sasl or error logger file...
>>>>
>>>>
>>>>
>>>> On Sunday, March 10, 2013, Valentin Kuznetsov wrote:
>>>>
>>>>> Hi,
>>>>> I built OTP application using rebar build tool and when I'm running on
>>>>> UNIX systems (both OSX and Linux) I see that created erlang.log.1 file has
>>>>> dos '\r' carriage return symbols in every line. I look-up on a web and did
>>>>> not find any reference about such behavior. I'll appreciate any suggestions
>>>>> why this happens (I don't think it's related to my application per-se and
>>>>> rather feel that it's somehow introduced by rebar, but I'm not sure). The
>>>>> carriage return symbols appears right after logging started message and
>>>>> follow up ever line after that. Here is an example of the head of my log.
>>>>>
>>>>> =====
>>>>> ===== LOGGING STARTED Sat Mar  9 20:55:02 EST 2013
>>>>> =====
>>>>> Exec:
>>>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/erts-5.9.3/bin/erlexec
>>>>> -boot
>>>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/releases/1/urlfetchd
>>>>> -mode embedded -config
>>>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/app.config
>>>>> -args_file
>>>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/vm.args --
>>>>> console^M
>>>>> Root: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd^M
>>>>> Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:2:2]
>>>>> [async-threads:5] [hipe] [kernel-poll:true]^M
>>>>> ^M
>>>>> ^M
>>>>>
>>>>> Thanks,
>>>>> Valentin.
>>>>> _______________________________________________
>>>>> erlang-questions mailing list
>>>>> 
>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> 
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>>
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130312/6b560bbb/attachment.html>


More information about the erlang-questions mailing list