You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Herr-Herner <wo...@gmx.de> on 2015/01/21 08:26:59 UTC

Strange characters appended to console output

I get strange ending characters at the end of my console request... Have a
look to the following command:

client -a 8101 -h localhost -u karaf " config:list
\"(service.pid=org.ops4j.pax.web)\" " >> ~/output.txt

It is important to pipe the output to the file otherwise the problem becomes
not visible. I am uncertain if this a new problem of 3.0.2. What are these
strange characters at the end? I must parse the console output, so the
regular expressions become much more complicated by now. Has anybody an idea
what is the cause of this? I am not sure if you can see the issue in this
post... Maybe you must try it on a running instance.

Output:
----------------------------------------------------------------
Pid:            org.ops4j.pax.web
BundleLocation: mvn:org.ops4j.pax.web/pax-web-runtime/3.1.2
Properties:
   javax.servlet.context.tempdir = /opt/apache-karaf-3.0.2/data/pax-web-jsp
   org.apache.karaf.features.configKey = org.ops4j.pax.web
   org.ops4j.pax.web.config.file = /opt/apache-karaf-3.0.2/etc/jetty.xml
   org.osgi.service.http.port = 8181
   service.pid = org.ops4j.pax.web




--
View this message in context: http://karaf.922171.n3.nabble.com/Strange-characters-appended-to-console-output-tp4037895.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Strange characters appended to console output

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
No sure it's a new issue in 3.0.2. Let me try on 3.0.1/3.0.0 (and master).

Regards
JB

On 01/21/2015 08:26 AM, Herr-Herner wrote:
> I get strange ending characters at the end of my console request... Have a
> look to the following command:
>
> client -a 8101 -h localhost -u karaf " config:list
> \"(service.pid=org.ops4j.pax.web)\" " >> ~/output.txt
>
> It is important to pipe the output to the file otherwise the problem becomes
> not visible. I am uncertain if this a new problem of 3.0.2. What are these
> strange characters at the end? I must parse the console output, so the
> regular expressions become much more complicated by now. Has anybody an idea
> what is the cause of this? I am not sure if you can see the issue in this
> post... Maybe you must try it on a running instance.
>
> Output:
> ----------------------------------------------------------------
> Pid:            org.ops4j.pax.web
> BundleLocation: mvn:org.ops4j.pax.web/pax-web-runtime/3.1.2
> Properties:
>     javax.servlet.context.tempdir = /opt/apache-karaf-3.0.2/data/pax-web-jsp
>     org.apache.karaf.features.configKey = org.ops4j.pax.web
>     org.ops4j.pax.web.config.file = /opt/apache-karaf-3.0.2/etc/jetty.xml
>     org.osgi.service.http.port = 8181
>     service.pid = org.ops4j.pax.web
> 
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Strange-characters-appended-to-console-output-tp4037895.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Strange characters appended to console output

Posted by Herr-Herner <wo...@gmx.de>.
Thanks a lot... I would have never found out what was the source of the
"problem". Some more things on the long journey ;-)

This is the regex in Ruby to remove the ANSI color commands:
output.gsub(/\e\[[\d;]*m/, ''')



--
View this message in context: http://karaf.922171.n3.nabble.com/Strange-characters-appended-to-console-output-tp4037895p4037914.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Strange characters appended to console output

Posted by ch...@kiffer.ltd.uk.
So Herr-Herner's next step is to google for "ansi control sequence regex"
(about 44100000 hits) ;-)

> Good catch Chris.
>
> It comes from jansi (for coloring indeed).
>
> Regards
> JB
>
> On 01/21/2015 09:38 AM, chris.gray@kiffer.ltd.uk wrote:
>>> The problem seems to occur on every request, e.g. also on:
>>>
>>> client -a 8101 -h localhost -u karaf " feature:list " >> ~/output.txt
>>>
>>> Name                          | Version          | Installed |
>>> Repository
>>> | Description
>>> -------------------------------------------------------------------------------------------------------------------------------------------
>>> pax-jetty                     | 8.1.15.v20140411 | x         |
>>> org.ops4j.pax.web-3.1.2 | Provide Jetty engine support
>>> ...
>>> 
>>>
>>> Strange!
>>
>> Nothing strange about it - it's an ANSI control sequence to reset the
>> text
>> colour:
>>
>> CSI n m 	SGR – Select Graphic Rendition 	Sets SGR parameters, including
>> text color. After CSI can be zero or more parameters separated with ;.
>> With no parameters, CSI m is treated as CSI 0 m (reset / normal)
>>
>> where CSI = ESC [
>>
>> :-)
>>
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>



Re: Strange characters appended to console output

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Good catch Chris.

It comes from jansi (for coloring indeed).

Regards
JB

On 01/21/2015 09:38 AM, chris.gray@kiffer.ltd.uk wrote:
>> The problem seems to occur on every request, e.g. also on:
>>
>> client -a 8101 -h localhost -u karaf " feature:list " >> ~/output.txt
>>
>> Name                          | Version          | Installed | Repository
>> | Description
>> -------------------------------------------------------------------------------------------------------------------------------------------
>> pax-jetty                     | 8.1.15.v20140411 | x         |
>> org.ops4j.pax.web-3.1.2 | Provide Jetty engine support
>> ...
>> 
>>
>> Strange!
>
> Nothing strange about it - it's an ANSI control sequence to reset the text
> colour:
>
> CSI n m 	SGR – Select Graphic Rendition 	Sets SGR parameters, including
> text color. After CSI can be zero or more parameters separated with ;.
> With no parameters, CSI m is treated as CSI 0 m (reset / normal)
>
> where CSI = ESC [
>
> :-)
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Strange characters appended to console output

Posted by Herr-Herner <wo...@gmx.de>.
Ah! Thank you very much to both of you.



--
View this message in context: http://karaf.922171.n3.nabble.com/Strange-characters-appended-to-console-output-tp4037895p4037905.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Strange characters appended to console output

Posted by ch...@kiffer.ltd.uk.
> The problem seems to occur on every request, e.g. also on:
>
> client -a 8101 -h localhost -u karaf " feature:list " >> ~/output.txt
>
> Name                          | Version          | Installed | Repository
> | Description
> -------------------------------------------------------------------------------------------------------------------------------------------
> pax-jetty                     | 8.1.15.v20140411 | x         |
> org.ops4j.pax.web-3.1.2 | Provide Jetty engine support
> ...
> 
>
> Strange!

Nothing strange about it - it's an ANSI control sequence to reset the text
colour:

CSI n m 	SGR – Select Graphic Rendition 	Sets SGR parameters, including
text color. After CSI can be zero or more parameters separated with ;.
With no parameters, CSI m is treated as CSI 0 m (reset / normal)

where CSI = ESC [

:-)



Re: Strange characters appended to console output

Posted by Herr-Herner <wo...@gmx.de>.
The problem seems to occur on every request, e.g. also on:

client -a 8101 -h localhost -u karaf " feature:list " >> ~/output.txt

Name                          | Version          | Installed | Repository             
| Description                                       
-------------------------------------------------------------------------------------------------------------------------------------------
pax-jetty                     | 8.1.15.v20140411 | x         |
org.ops4j.pax.web-3.1.2 | Provide Jetty engine support                      
...


Strange!



--
View this message in context: http://karaf.922171.n3.nabble.com/Strange-characters-appended-to-console-output-tp4037895p4037896.html
Sent from the Karaf - User mailing list archive at Nabble.com.