[OpenSER-Devel] [ openser-Bugs-1765327 ] XLOG: color ANSI code not usable for colorize system log

SourceForge.net noreply at sourceforge.net
Wed Aug 1 20:54:18 CEST 2007


Bugs item #1765327, was opened at 2007-08-01 16:28
Message generated for change (Comment added) made by dan_pascu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1765327&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: ver 1.2.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Iñaki Baz (ibc_sf)
Assigned to: Nobody/Anonymous (nobody)
Summary: XLOG: color ANSI code not usable for colorize system log

Initial Comment:
In background mode I'm trying to colorize openser logs.

I use XLOG with the syntax $(Cxx) and so and works nice in foregorund mode:

  xlog("L_INFO", "$(Csc)$rm $ru$(Cxx)\n");

But ni background mode it generates logs like:

  ^[[0;30;46mINVITE sip:500 at domain.org


I wonder why it doesn't generate correct ANSI code:

  \033[0;30;46m  <-- correct ANSI code
instead of:
  ^[[0;30;46m

If it would generate \033[0;30;46m (correct ANSI code) then I could colorize the log file using multitail and other colorize solutions that understand ANSI code.

----------------------------------------------------------------------

>Comment By: Dan (dan_pascu)
Date: 2007-08-01 21:54

Message:
Logged In: YES 
user_id=1296758
Originator: NO

Also regarding your issue with it not being shown when running in the
background, it may be related to how syslog interprets that character.
Syslog may deliberately remove colouring, by replacing control characters
with ^something. Just a thought.


----------------------------------------------------------------------

Comment By: Dan (dan_pascu)
Date: 2007-08-01 21:47

Message:
Logged In: YES 
user_id=1296758
Originator: NO

Most likely because the ^[ were introduced as 2 distinct characters, as
oposed to ^[ which is control-[ i.e. the \x1b or \033 character. When I
typed ^[ I really meant control-[ not the 2 distinct chars ^ and [. If this
is generated in the C code then it would be easier to write it as \033 or
\x1b because ^[ is just a notation to indicate control-[ not 2 distinct
characters.


----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2007-08-01 18:26

Message:
Logged In: YES 
user_id=1844020
Originator: YES

Then, why the following command in Bash terminal print "HELLO" in color:

  echo -e "\033[0;30;46mHELLO"

while this one:

  echo -e "^[[0;30;46mHELLO"

prints ^[[0;30;46mHELLO with no color at all?

Thanks for your response.

----------------------------------------------------------------------

Comment By: Dan (dan_pascu)
Date: 2007-08-01 17:39

Message:
Logged In: YES 
user_id=1296758
Originator: NO

\033 and ^[ are the same code that corresponds to ESC (0x1b). It should
work with either one, they're just different notations of the same thing.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1765327&group_id=139143



More information about the Devel mailing list