Discussion:
Beginner's question - Jetty configuration
Tim Ward
2016-11-18 14:11:59 UTC
Permalink
Very simple, I hope, but days of research haven't found an answer that
works yet.

How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?

The osgi-dev mailing list referred me here.

(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.

I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.

I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.

I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
Jean-Baptiste Onofré
2016-11-18 14:16:54 UTC
Permalink
Hi Tim,

when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.

This cfg file can refer to a jetty.xml using:

org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml

Then the etc/jetty.xml is a jetty file.

Regards
JB
Post by Tim Ward
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
***@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Tim Ward
2016-11-18 14:24:52 UTC
Permalink
Thanks, but as I said, that's one of the things I tried:

"I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work."

(Typo in the above, of course I meant org.ops4j.pax.web.cfg not
org.ops4j.paw.web.cfg.)

I expected to see something in log\karaf.log telling me about syntax
errors in the jetty.xml, but I didn't, even at DEBUG level, so I can
have no confidence that the jetty.xml was read (and thus no obvious
incentive to invest further time working out what to put in it).
Post by Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Post by Tim Ward
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
--
Tim Ward
Achim Nierbeck
2016-11-18 14:27:10 UTC
Permalink
Hi Tim,

as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's configuration should
first be configured by the HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different configuration
syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Call name="addConnector">

or

<Get name="handler">
<Call name="addHandler">

to adapt the configuration.
A complete jetty.xml can be found here [2].

regards, Achim

[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml
Post by Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Post by Tim Ward
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Achim Nierbeck
2016-11-18 14:28:26 UTC
Permalink
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless there is at least one
application capable of listening to it.
It's been a feature request in the past.

regards, Achim
Post by Jean-Baptiste Onofré
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's configuration should
first be configured by the HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different configuration
syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Call name="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/
samples/jetty-config-fragment/src/main/resources/jetty.xml
Post by Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Post by Tim Ward
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Tim Ward
2016-11-18 14:43:49 UTC
Permalink
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless there is at
least one application capable of listening to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have deliberately set it to 8181
using configuration.json, and it works - my servlets respond on 8181,
before I did this the default was 8080.
Post by Achim Nierbeck
regards, Achim
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's configuration
should first be configured by the HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different
configuration syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Callname="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
<http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html>
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml>
Hi Tim,
when you install the jetty feature, you can override the
default configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Very simple, I hope, but days of research haven't found an
answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on
request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by
setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of
output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in
the hope of
getting some error messages about the gibberish, showing
that at least
something was reading the jetty.xml, but that didn't work.
It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any
of the above,
just snippets of example code, so all my attempts were
probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
Achim Nierbeck
2016-11-18 14:51:07 UTC
Permalink
Hi Tim,

in [1], you'll find the current configurations available.
a configuration.json will not be used by pax-web. You have to use the
org.ops4j.pax.web.cfg as it's used to feed
the ConfigurationAdmin service. Those properties are then propagated to the
corresponding OSGi service.
Regarding NCSA logger, yes it's possible, just configure it appropriately.
We have a test for it, which is disabled right now
as we have some "file" race-conditions on it. [2]
A full list of possible configurations can also be found here [3]

regards, Achim

[1] -
http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#basic-configuration
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpServiceIntegrationTest.java#L405-L437
[3] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless there is at least
one application capable of listening to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have deliberately set it to 8181
using configuration.json, and it works - my servlets respond on 8181,
before I did this the default was 8080.
regards, Achim
Post by Jean-Baptiste Onofré
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's configuration should
first be configured by the HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different
configuration syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Call name="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/sa
mples/jetty-config-fragment/src/main/resources/jetty.xml
Post by Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Post by Tim Ward
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Tim Ward
2016-11-18 15:00:08 UTC
Permalink
Yes, I've tried various versions of those things, and they don't work
for me.

I've just tried again, and it didn't work again.

(1) I put

org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format =
c:\\karaf\\access\\yyyy_mm_dd.request.log

into my org.ops4j.pax.web.cfg.

(2) Something appears to have noticed that this file has changed, as witness

2016-11-18 14:55:28,880 | DEBUG | karaf\bin\..\etc |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()
2016-11-18 14:55:28,881 | INFO | karaf\bin\..\etc |
fileinstall | 4 - org.apache.felix.fileinstall -
3.5.4 | Updating configuration from org.ops4j.pax.web.cfg
2016-11-18 14:55:28,889 | DEBUG | g.ops4j.pax.web) |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()

(3) I made sure the directory c:\karaf\access existed, just in case the
logging code doesn't create its own directories.

(4) I made a request of the web server, which returned a response to the
browser. Checking the DEBUG level messages in the Karaf log confirms
that it did handle the request.

(5) No log file appeared in c:\karaf\access.
Post by Jean-Baptiste Onofré
Hi Tim,
in [1], you'll find the current configurations available.
a configuration.json will not be used by pax-web. You have to use the
org.ops4j.pax.web.cfg as it's used to feed
the ConfigurationAdmin service. Those properties are then propagated
to the corresponding OSGi service.
Regarding NCSA logger, yes it's possible, just configure it
appropriately. We have a test for it, which is disabled right now
as we have some "file" race-conditions on it. [2]
A full list of possible configurations can also be found here [3]
regards, Achim
[1] -
http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#basic-configuration
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpServiceIntegrationTest.java#L405-L437
[3] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless there is at
least one application capable of listening to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have deliberately set it to
8181 using configuration.json, and it works - my servlets respond
on 8181, before I did this the default was 8080.
Post by Achim Nierbeck
regards, Achim
2016-11-18 15:27 GMT+01:00 Achim Nierbeck
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's
configuration should first be configured by the HttpService
configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different
configuration syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Callname="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
<http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html>
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml>
2016-11-18 15:16 GMT+01:00 Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override the
default configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Very simple, I hope, but days of research haven't
found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As
the simplest
possible initial beginner's question, how do I turn
on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by
setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then
looking in
data\log\karaf.log, but given the volume and format
of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log
in
org.ops4j.paw.web.cfg but that doesn't seen to do
anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in
org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish,
showing that at least
something was reading the jetty.xml, but that didn't
work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of
any of the above,
just snippets of example code, so all my attempts
were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
Achim Nierbeck
2016-11-18 15:14:22 UTC
Permalink
Hi Tim,

the format is wrong.
You need to set the format, but not the file to write to.
If you want to write to another directory you need to set the following

org.ops4j.pax.web.log.ncsa.directory=c:/karaf/access/


regards, Achim
Yes, I've tried various versions of those things, and they don't work for
me.
I've just tried again, and it didn't work again.
(1) I put
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = c:\\karaf\\access\\yyyy_mm_dd.
request.log
into my org.ops4j.pax.web.cfg.
(2) Something appears to have noticed that this file has changed, as witness
2016-11-18 14:55:28,880 | DEBUG | karaf\bin\..\etc |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()
2016-11-18 14:55:28,881 | INFO | karaf\bin\..\etc |
fileinstall | 4 - org.apache.felix.fileinstall -
3.5.4 | Updating configuration from org.ops4j.pax.web.cfg
2016-11-18 14:55:28,889 | DEBUG | g.ops4j.pax.web) |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()
(3) I made sure the directory c:\karaf\access existed, just in case the
logging code doesn't create its own directories.
(4) I made a request of the web server, which returned a response to the
browser. Checking the DEBUG level messages in the Karaf log confirms that
it did handle the request.
(5) No log file appeared in c:\karaf\access.
Hi Tim,
in [1], you'll find the current configurations available.
a configuration.json will not be used by pax-web. You have to use the
org.ops4j.pax.web.cfg as it's used to feed
the ConfigurationAdmin service. Those properties are then propagated to
the corresponding OSGi service.
Regarding NCSA logger, yes it's possible, just configure it appropriately.
We have a test for it, which is disabled right now
as we have some "file" race-conditions on it. [2]
A full list of possible configurations can also be found here [3]
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#
basic-configuration
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/
pax-web-itest/pax-web-itest-container/pax-web-itest-
container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/
HttpServiceIntegrationTest.java#L405-L437
[3] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/
pax-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless there is at least
one application capable of listening to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have deliberately set it to 8181
using configuration.json, and it works - my servlets respond on 8181,
before I did this the default was 8080.
regards, Achim
Post by Jean-Baptiste Onofré
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's configuration should
first be configured by the HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different
configuration syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Call name="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/sa
mples/jetty-config-fragment/src/main/resources/jetty.xml
Post by Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Post by Tim Ward
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Tim Ward
2016-11-18 15:25:06 UTC
Permalink
Ah, thank you.

(1) That wasn't clear from any documentation I found.

(2) I would have hoped to get an error message in the log if I'd coded
it wrongly?

(3) And it still doesn't work: I now have

org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = yyyy_mm_dd.request.log
org.ops4j.pax.web.log.ncsa.directory = c:/karaf/access/

but still no log file being created in c:\karaf\access.
Post by Jean-Baptiste Onofré
Hi Tim,
the format is wrong.
You need to set the format, but not the file to write to.
If you want to write to another directory you need to set the following
org.ops4j.pax.web.log.ncsa.directory=c:/karaf/access/
regards, Achim
Yes, I've tried various versions of those things, and they don't
work for me.
I've just tried again, and it didn't work again.
(1) I put
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format =
c:\\karaf\\access\\yyyy_mm_dd.request.log
into my org.ops4j.pax.web.cfg.
(2) Something appears to have noticed that this file has changed, as witness
2016-11-18 14:55:28,880 | DEBUG | karaf\bin\..\etc | configadmin
| 3 - org.apache.felix.configadmin - 1.8.8 | getProperties()
2016-11-18 14:55:28,881 | INFO | karaf\bin\..\etc | fileinstall
| 4 - org.apache.felix.fileinstall - 3.5.4 | Updating
configuration from org.ops4j.pax.web.cfg
2016-11-18 14:55:28,889 | DEBUG | g.ops4j.pax.web) | configadmin
| 3 - org.apache.felix.configadmin - 1.8.8 | getProperties()
(3) I made sure the directory c:\karaf\access existed, just in
case the logging code doesn't create its own directories.
(4) I made a request of the web server, which returned a response
to the browser. Checking the DEBUG level messages in the Karaf log
confirms that it did handle the request.
(5) No log file appeared in c:\karaf\access.
Post by Jean-Baptiste Onofré
Hi Tim,
in [1], you'll find the current configurations available.
a configuration.json will not be used by pax-web. You have to use
the org.ops4j.pax.web.cfg as it's used to feed
the ConfigurationAdmin service. Those properties are then
propagated to the corresponding OSGi service.
Regarding NCSA logger, yes it's possible, just configure it
appropriately. We have a test for it, which is disabled right now
as we have some "file" race-conditions on it. [2]
A full list of possible configurations can also be found here [3]
regards, Achim
[1] -
http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#basic-configuration
<http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#basic-configuration>
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpServiceIntegrationTest.java#L405-L437
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpServiceIntegrationTest.java#L405-L437>
[3] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml>
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless there
is at least one application capable of listening to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have deliberately set
it to 8181 using configuration.json, and it works - my
servlets respond on 8181, before I did this the default was
8080.
Post by Achim Nierbeck
regards, Achim
2016-11-18 15:27 GMT+01:00 Achim Nierbeck
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's
configuration should first be configured by the
HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight
different configuration syntax, as you configure an
already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Callname="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] -
http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
<http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html>
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml>
2016-11-18 15:16 GMT+01:00 Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override
the default configuration using
etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Very simple, I hope, but days of research
haven't found an answer that
works yet.
How do change the configuration of Jetty in
Karaf? As the simplest
possible initial beginner's question, how do I
turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with
requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and
then looking in
data\log\karaf.log, but given the volume and
format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log
in
org.ops4j.paw.web.cfg but that doesn't seen to
do anything.
I've tried creating a gibberish jetty.xml,
pointed to by
org.ops4j.pax.web.config.file in
org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish,
showing that at least
something was reading the jetty.xml, but that
didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual
*documentation* of any of the above,
just snippets of example code, so all my
attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web
<http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
Achim Nierbeck
2016-11-18 15:31:44 UTC
Permalink
hmm ...
as it's windows and it's always a hard time to write to files on windows
...
could you experiment with the directory a bit.

it could also be

c:\\karaf

sorry it's been quite a long time since the last time I used windows.

OTH you might just leave it alone.

One way would be to start slow with only setting the

org.ops4j.pax.web.log.ncsa.enabled = true

in the configuration.
The log file should be appended to $KARAF_HOME/logs if nothing else is
configured.

Usually you also find a log message in the logs, telling where it tries to
log to:

NCSARequestlogging is using the following directory:


regards, Achim
Post by Tim Ward
Ah, thank you.
(1) That wasn't clear from any documentation I found.
(2) I would have hoped to get an error message in the log if I'd coded it
wrongly?
(3) And it still doesn't work: I now have
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = yyyy_mm_dd.request.log
org.ops4j.pax.web.log.ncsa.directory = c:/karaf/access/
but still no log file being created in c:\karaf\access.
Hi Tim,
the format is wrong.
You need to set the format, but not the file to write to.
If you want to write to another directory you need to set the following
org.ops4j.pax.web.log.ncsa.directory=c:/karaf/access/
regards, Achim
Yes, I've tried various versions of those things, and they don't work for
me.
I've just tried again, and it didn't work again.
(1) I put
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = c:\\karaf\\access\\yyyy_mm_dd.
request.log
into my org.ops4j.pax.web.cfg.
(2) Something appears to have noticed that this file has changed, as witness
2016-11-18 14:55:28,880 | DEBUG | karaf\bin\..\etc |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()
2016-11-18 14:55:28,881 | INFO | karaf\bin\..\etc |
fileinstall | 4 - org.apache.felix.fileinstall -
3.5.4 | Updating configuration from org.ops4j.pax.web.cfg
2016-11-18 14:55:28,889 | DEBUG | g.ops4j.pax.web) |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()
(3) I made sure the directory c:\karaf\access existed, just in case the
logging code doesn't create its own directories.
(4) I made a request of the web server, which returned a response to the
browser. Checking the DEBUG level messages in the Karaf log confirms that
it did handle the request.
(5) No log file appeared in c:\karaf\access.
Hi Tim,
in [1], you'll find the current configurations available.
a configuration.json will not be used by pax-web. You have to use the
org.ops4j.pax.web.cfg as it's used to feed
the ConfigurationAdmin service. Those properties are then propagated to
the corresponding OSGi service.
Regarding NCSA logger, yes it's possible, just configure it
appropriately. We have a test for it, which is disabled right now
as we have some "file" race-conditions on it. [2]
A full list of possible configurations can also be found here [3]
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#ba
sic-configuration
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax
-web-itest/pax-web-itest-container/pax-web-itest-container-
jetty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpServic
eIntegrationTest.java#L405-L437
[3] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax
-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless there is at least
one application capable of listening to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have deliberately set it to 8181
using configuration.json, and it works - my servlets respond on 8181,
before I did this the default was 8080.
regards, Achim
Post by Jean-Baptiste Onofré
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's configuration
should first be configured by the HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different
configuration syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Call name="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/sa
mples/jetty-config-fragment/src/main/resources/jetty.xml
Post by Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Post by Tim Ward
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Achim Nierbeck
2016-11-18 15:33:03 UTC
Permalink
One more thing ...

Pax-Web already tries to run with the best default values, therefore it
might be good if you start with a
"clean" state and start customizing from there.

regards, Achim
Post by Achim Nierbeck
hmm ...
as it's windows and it's always a hard time to write to files on windows
...
could you experiment with the directory a bit.
it could also be
c:\\karaf
sorry it's been quite a long time since the last time I used windows.
OTH you might just leave it alone.
One way would be to start slow with only setting the
org.ops4j.pax.web.log.ncsa.enabled = true
in the configuration.
The log file should be appended to $KARAF_HOME/logs if nothing else is
configured.
Usually you also find a log message in the logs, telling where it tries to
regards, Achim
Post by Tim Ward
Ah, thank you.
(1) That wasn't clear from any documentation I found.
(2) I would have hoped to get an error message in the log if I'd coded it
wrongly?
(3) And it still doesn't work: I now have
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = yyyy_mm_dd.request.log
org.ops4j.pax.web.log.ncsa.directory = c:/karaf/access/
but still no log file being created in c:\karaf\access.
Hi Tim,
the format is wrong.
You need to set the format, but not the file to write to.
If you want to write to another directory you need to set the following
org.ops4j.pax.web.log.ncsa.directory=c:/karaf/access/
regards, Achim
Post by Tim Ward
Yes, I've tried various versions of those things, and they don't work
for me.
I've just tried again, and it didn't work again.
(1) I put
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = c:\\karaf\\access\\yyyy_mm_dd.
request.log
into my org.ops4j.pax.web.cfg.
(2) Something appears to have noticed that this file has changed, as witness
2016-11-18 14:55:28,880 | DEBUG | karaf\bin\..\etc |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()
2016-11-18 14:55:28,881 | INFO | karaf\bin\..\etc |
fileinstall | 4 - org.apache.felix.fileinstall -
3.5.4 | Updating configuration from org.ops4j.pax.web.cfg
2016-11-18 14:55:28,889 | DEBUG | g.ops4j.pax.web) |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()
(3) I made sure the directory c:\karaf\access existed, just in case the
logging code doesn't create its own directories.
(4) I made a request of the web server, which returned a response to the
browser. Checking the DEBUG level messages in the Karaf log confirms that
it did handle the request.
(5) No log file appeared in c:\karaf\access.
Hi Tim,
in [1], you'll find the current configurations available.
a configuration.json will not be used by pax-web. You have to use the
org.ops4j.pax.web.cfg as it's used to feed
the ConfigurationAdmin service. Those properties are then propagated to
the corresponding OSGi service.
Regarding NCSA logger, yes it's possible, just configure it
appropriately. We have a test for it, which is disabled right now
as we have some "file" race-conditions on it. [2]
A full list of possible configurations can also be found here [3]
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#ba
sic-configuration
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax
-web-itest/pax-web-itest-container/pax-web-itest-container-j
etty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpService
IntegrationTest.java#L405-L437
[3] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax
-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless there is at least
one application capable of listening to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have deliberately set it to 8181
using configuration.json, and it works - my servlets respond on 8181,
before I did this the default was 8080.
regards, Achim
Post by Jean-Baptiste Onofré
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's configuration
should first be configured by the HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different
configuration syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Call name="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/sa
mples/jetty-config-fragment/src/main/resources/jetty.xml
Post by Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Post by Tim Ward
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Tim Ward
2016-11-18 15:39:31 UTC
Permalink
Sorry, I don't understand that. What should I actually *do* to "start
with a clean state" - what changes should I make to which files?
Post by Achim Nierbeck
One more thing ...
Pax-Web already tries to run with the best default values, therefore
it might be good if you start with a
"clean" state and start customizing from there.
regards, Achim
hmm ...
as it's windows and it's always a hard time to write to files on
windows ...
could you experiment with the directory a bit.
it could also be
c:\\karaf
sorry it's been quite a long time since the last time I used windows.
OTH you might just leave it alone.
One way would be to start slow with only setting the
org.ops4j.pax.web.log.ncsa.enabled = true
in the configuration.
The log file should be appended to $KARAF_HOME/logs if nothing
else is configured.
Usually you also find a log message in the logs, telling where it
regards, Achim
Ah, thank you.
(1) That wasn't clear from any documentation I found.
(2) I would have hoped to get an error message in the log if
I'd coded it wrongly?
(3) And it still doesn't work: I now have
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = yyyy_mm_dd.request.log
org.ops4j.pax.web.log.ncsa.directory = c:/karaf/access/
but still no log file being created in c:\karaf\access.
Post by Jean-Baptiste Onofré
Hi Tim,
the format is wrong.
You need to set the format, but not the file to write to.
If you want to write to another directory you need to set the following
org.ops4j.pax.web.log.ncsa.directory=c:/karaf/access/
regards, Achim
Yes, I've tried various versions of those things, and
they don't work for me.
I've just tried again, and it didn't work again.
(1) I put
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format =
c:\\karaf\\access\\yyyy_mm_dd.request.log
into my org.ops4j.pax.web.cfg.
(2) Something appears to have noticed that this file has
changed, as witness
2016-11-18 14:55:28,880 | DEBUG | karaf\bin\..\etc |
configadmin | 3 - org.apache.felix.configadmin - 1.8.8 |
getProperties()
2016-11-18 14:55:28,881 | INFO | karaf\bin\..\etc |
fileinstall | 4 - org.apache.felix.fileinstall - 3.5.4 |
Updating configuration from org.ops4j.pax.web.cfg
2016-11-18 14:55:28,889 | DEBUG | g.ops4j.pax.web) |
configadmin | 3 - org.apache.felix.configadmin - 1.8.8 |
getProperties()
(3) I made sure the directory c:\karaf\access existed,
just in case the logging code doesn't create its own
directories.
(4) I made a request of the web server, which returned a
response to the browser. Checking the DEBUG level
messages in the Karaf log confirms that it did handle the
request.
(5) No log file appeared in c:\karaf\access.
Post by Jean-Baptiste Onofré
Hi Tim,
in [1], you'll find the current configurations available.
a configuration.json will not be used by pax-web. You
have to use the org.ops4j.pax.web.cfg as it's used to feed
the ConfigurationAdmin service. Those properties are
then propagated to the corresponding OSGi service.
Regarding NCSA logger, yes it's possible, just configure
it appropriately. We have a test for it, which is
disabled right now
as we have some "file" race-conditions on it. [2]
A full list of possible configurations can also be found
here [3]
regards, Achim
[1] -
http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#basic-configuration
<http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#basic-configuration>
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpServiceIntegrationTest.java#L405-L437
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpServiceIntegrationTest.java#L405-L437>
[3] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml>
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181
unless there is at least one application capable of
listening to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have
deliberately set it to 8181 using
configuration.json, and it works - my servlets
respond on 8181, before I did this the default was
8080.
Post by Achim Nierbeck
regards, Achim
2016-11-18 15:27 GMT+01:00 Achim Nierbeck
Hi Tim,
as JB already said, that's part of the
configuration.
For more details on how to use Pax-Web can be
found here [1].
Also keep in mind, as Pax-Web is a HttpService
it's configuration should first be configured
by the HttpService configuration,
found in the org.ops4j.pax.web config file,
like port etc.
Only for enhanced configurations you should use
jetty.xml.
Another point here, the jetty.xml uses some
slight different configuration syntax, as you
configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Callname="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] -
http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
<http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html>
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml>
2016-11-18 15:16 GMT+01:00 Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can
override the default configuration using
etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Very simple, I hope, but days of
research haven't found an answer that
works yet.
How do change the configuration of
Jetty in Karaf? As the simplest
possible initial beginner's question,
how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing
with requests by setting the log
level to DEBUG in
org.ops4j.pax.logging.cfg and then
looking in
data\log\karaf.log, but given the
volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log
in
org.ops4j.paw.web.cfg but that doesn't
seen to do anything.
I've tried creating a gibberish
jetty.xml, pointed to by
org.ops4j.pax.web.config.file in
org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the
gibberish, showing that at least
something was reading the jetty.xml,
but that didn't work. It didn't
work doing the same via
configuration.json either.
I haven't really found any actual
*documentation* of any of the above,
just snippets of example code, so all
my attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/>
Committer & PMC
OPS4J Pax Web
<http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook
<http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum
Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web
<http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook
<http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web
<http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
Achim Nierbeck
2016-11-18 15:41:30 UTC
Permalink
I'm not sure which thread I just responded before.
But best to start with a fresh Vanilla Karaf first.
I fear with all those tryings of you to somehow configure the server, it's
not possible to
help via mailinglist ...

regards, Achim
Sorry, I don't understand that. What should I actually *do* to "start with
a clean state" - what changes should I make to which files?
One more thing ...
Pax-Web already tries to run with the best default values, therefore it
might be good if you start with a
"clean" state and start customizing from there.
regards, Achim
Post by Achim Nierbeck
hmm ...
as it's windows and it's always a hard time to write to files on windows
...
could you experiment with the directory a bit.
it could also be
c:\\karaf
sorry it's been quite a long time since the last time I used windows.
OTH you might just leave it alone.
One way would be to start slow with only setting the
org.ops4j.pax.web.log.ncsa.enabled = true
in the configuration.
The log file should be appended to $KARAF_HOME/logs if nothing else is
configured.
Usually you also find a log message in the logs, telling where it tries
regards, Achim
Post by Tim Ward
Ah, thank you.
(1) That wasn't clear from any documentation I found.
(2) I would have hoped to get an error message in the log if I'd coded
it wrongly?
(3) And it still doesn't work: I now have
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = yyyy_mm_dd.request.log
org.ops4j.pax.web.log.ncsa.directory = c:/karaf/access/
but still no log file being created in c:\karaf\access.
Hi Tim,
the format is wrong.
You need to set the format, but not the file to write to.
If you want to write to another directory you need to set the following
org.ops4j.pax.web.log.ncsa.directory=c:/karaf/access/
regards, Achim
Post by Tim Ward
Yes, I've tried various versions of those things, and they don't work
for me.
I've just tried again, and it didn't work again.
(1) I put
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = c:\\karaf\\access\\yyyy_mm_dd.
request.log
into my org.ops4j.pax.web.cfg.
(2) Something appears to have noticed that this file has changed, as witness
2016-11-18 14:55:28,880 | DEBUG | karaf\bin\..\etc |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()
2016-11-18 14:55:28,881 | INFO | karaf\bin\..\etc |
fileinstall | 4 - org.apache.felix.fileinstall -
3.5.4 | Updating configuration from org.ops4j.pax.web.cfg
2016-11-18 14:55:28,889 | DEBUG | g.ops4j.pax.web) |
configadmin | 3 - org.apache.felix.configadmin -
1.8.8 | getProperties()
(3) I made sure the directory c:\karaf\access existed, just in case the
logging code doesn't create its own directories.
(4) I made a request of the web server, which returned a response to
the browser. Checking the DEBUG level messages in the Karaf log confirms
that it did handle the request.
(5) No log file appeared in c:\karaf\access.
Hi Tim,
in [1], you'll find the current configurations available.
a configuration.json will not be used by pax-web. You have to use the
org.ops4j.pax.web.cfg as it's used to feed
the ConfigurationAdmin service. Those properties are then propagated to
the corresponding OSGi service.
Regarding NCSA logger, yes it's possible, just configure it
appropriately. We have a test for it, which is disabled right now
as we have some "file" race-conditions on it. [2]
A full list of possible configurations can also be found here [3]
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#ba
sic-configuration
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax
-web-itest/pax-web-itest-container/pax-web-itest-container-j
etty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpService
IntegrationTest.java#L405-L437
[3] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax
-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless there is at
least one application capable of listening to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have deliberately set it to 8181
using configuration.json, and it works - my servlets respond on 8181,
before I did this the default was 8080.
regards, Achim
Post by Jean-Baptiste Onofré
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
Also keep in mind, as Pax-Web is a HttpService it's configuration
should first be configured by the HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different
configuration syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Call name="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
[2] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/sa
mples/jetty-config-fragment/src/main/resources/jetty.xml
Post by Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Post by Tim Ward
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Tim Ward
2016-11-18 15:43:32 UTC
Permalink
Post by Achim Nierbeck
I'm not sure which thread I just responded before.
But best to start with a fresh Vanilla Karaf first.
What do you mean by that? - as far as I know I have downloaded and
installed Karaf, then installed a couple of tiny bundles of my own so
that I've got a servlet to run. How could it be much more "vanilla" than
that?
Post by Achim Nierbeck
I fear with all those tryings of you to somehow configure the server,
it's not possible to
help via mailinglist ...
regards, Achim
--
Tim Ward
Achim Nierbeck
2016-11-18 15:49:14 UTC
Permalink
In combination with the thread on the bnd-tools or osgi-dev I've been under
the impression that you already tried to
tweak on certain configurational aspects.
Therefore I tried to suggest to start with a vanilla instance so we can
proceed from there.
For instance this time it's your first statement about which bundles you
actually did install yourself. As I'm not capable of
reading mind I have no clue what so ever you have been trying before and
which bundles have been installed.


regards, Achim
Post by Tim Ward
Post by Achim Nierbeck
I'm not sure which thread I just responded before.
But best to start with a fresh Vanilla Karaf first.
What do you mean by that? - as far as I know I have downloaded and
installed Karaf, then installed a couple of tiny bundles of my own so that
I've got a servlet to run. How could it be much more "vanilla" than that?
I fear with all those tryings of you to somehow configure the server, it's
Post by Achim Nierbeck
not possible to
help via mailinglist ...
regards, Achim
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Tim Ward
2016-11-18 15:58:56 UTC
Permalink
Post by Achim Nierbeck
In combination with the thread on the bnd-tools or osgi-dev I've been
under the impression that you already tried to
tweak on certain configurational aspects.
Yes, I have been trying for some time to get at various aspects of Jetty
configuration, and on making no progress at osgi-dev I was finally told
"oh, if you're using Karaf that's out of scope for this list, try the
Karaf list".
Post by Achim Nierbeck
Therefore I tried to suggest to start with a vanilla instance so we
can proceed from there.
Sorry, I still don't know what you mean by "vanilla instance".

I downloaded and installed Karaf.

I wrote a couple of servlets using bndtools.

I am now trying to debug them using the instructions in
http://enroute.osgi.org/appnotes/bndtools-and-karaf.html.

If I leave out any of the above I've no longer got anything I can run to
test whether or not I've managed to switch on Jetty request logging.
Post by Achim Nierbeck
For instance this time it's your first statement about which bundles
you actually did install yourself. As I'm not capable of
reading mind I have no clue what so ever you have been trying before
and which bundles have been installed.
As per http://enroute.osgi.org/appnotes/bndtools-and-karaf.html plus the
stuff I've written myself.
Post by Achim Nierbeck
regards, Achim
I'm not sure which thread I just responded before.
But best to start with a fresh Vanilla Karaf first.
What do you mean by that? - as far as I know I have downloaded and
installed Karaf, then installed a couple of tiny bundles of my own
so that I've got a servlet to run. How could it be much more
"vanilla" than that?
I fear with all those tryings of you to somehow configure the
server, it's not possible to
help via mailinglist ...
regards, Achim
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
Tim Ward
2016-11-18 16:07:53 UTC
Permalink
Here is the list of things Karaf knows about, if that helps:

***@root()> list -t 0
START LEVEL 100 , List Threshold: 0
ID | State | Lvl | Version | Name
-------------------------------------------------------------------------------------------------------------------
0 | Active | 0 | 5.4.0 | System Bundle
1 | Active | 8 | 1.8.5 | OPS4J Pax Logging - API
2 | Active | 8 | 1.8.5 | OPS4J Pax Logging - Service
3 | Active | 10 | 1.8.8 | Apache Felix
Configuration Admin Service
4 | Active | 11 | 3.5.4 | Apache Felix File Install
5 | Active | 5 | 1.1.2 | Apache Felix Metatype
Service
6 | Active | 5 | 4.0.7 | Apache Karaf :: OSGi
Services :: EventAdmin
7 | Active | 5 | 2.4.7 | OPS4J Pax Url - aether:
8 | Active | 30 | 4.0.7 | Apache Karaf ::
Features :: Core
9 | Active | 30 | 2.14.2 | JLine
10 | Active | 20 | 1.0.1 | Apache Aries Blueprint API
11 | Active | 20 | 1.0.8 | Apache Aries Blueprint CM
12 | Active | 20 | 1.6.2 | Apache Aries Blueprint
Core, Fragments: 13
13 | Resolved | 20 | 1.0.0 | Apache Aries Blueprint
Core Compatiblity Fragment Bundle, Hosts: 12
14 | Active | 30 | 1.1.5 | Apache Aries JMX API
15 | Active | 30 | 1.1.5 | Apache Aries JMX
Blueprint API
16 | Active | 30 | 1.1.5 | Apache Aries JMX
Blueprint Core
17 | Active | 30 | 1.1.6 | Apache Aries JMX Core
18 | Active | 30 | 1.1.5 | Apache Aries Whiteboard
support for JMX DynamicMBean services
19 | Active | 20 | 1.0.1 | Apache Aries Proxy API
20 | Active | 20 | 1.0.5 | Apache Aries Proxy Service
21 | Active | 20 | 1.1.1 | Apache Aries Util
22 | Active | 30 | 4.0.7 | Apache Karaf :: Bundle
:: BlueprintStateService
23 | Active | 30 | 4.0.7 | Apache Karaf :: Bundle
:: Core
24 | Active | 30 | 4.0.7 | Apache Karaf ::
ConfigAdmin :: Core
25 | Active | 24 | 4.0.7 | Apache Karaf ::
Deployer :: Blueprint
26 | Active | 26 | 4.0.7 | Apache Karaf ::
Deployer :: Features
27 | Active | 24 | 4.0.7 | Apache Karaf ::
Deployer :: Karaf Archive (.kar)
28 | Active | 24 | 4.0.7 | Apache Karaf ::
Deployer :: Wrap Non OSGi Jar
29 | Active | 30 | 4.0.7 | Apache Karaf ::
Diagnostic :: Core
30 | Active | 30 | 4.0.7 | Apache Karaf ::
Features :: Command
31 | Active | 30 | 4.0.7 | Apache Karaf ::
Instance :: Core
32 | Active | 30 | 4.0.7 | Apache Karaf :: JAAS ::
Blueprint :: Config
33 | Active | 30 | 4.0.7 | Apache Karaf :: JAAS ::
Command
34 | Active | 30 | 4.0.7 | Apache Karaf :: JAAS ::
Config
35 | Active | 30 | 4.0.7 | Apache Karaf :: JAAS ::
Modules
36 | Active | 30 | 4.0.7 | Apache Karaf :: KAR :: Core
37 | Active | 30 | 4.0.7 | Apache Karaf :: Log :: Core
38 | Active | 30 | 4.0.7 | Apache Karaf :: Management
39 | Active | 30 | 4.0.7 | Apache Karaf :: Package
:: Core
40 | Active | 30 | 4.0.7 | Apache Karaf :: Service
:: Core
41 | Active | 30 | 4.0.7 | Apache Karaf :: Shell
:: Various Commands
42 | Resolved | 30 | 4.0.7 | Apache Karaf :: Shell
:: Console, Hosts: 43
43 | Active | 30 | 4.0.7 | Apache Karaf :: Shell
:: Core, Fragments: 42
44 | Active | 30 | 4.0.7 | Apache Karaf :: Shell
:: SSH
45 | Active | 30 | 4.0.7 | Apache Karaf :: Shell
:: Table
46 | Active | 30 | 4.0.7 | Apache Karaf :: System
:: Core
47 | Active | 30 | 0.3.11.1 | Apache ServiceMix ::
Bundles :: not-yet-commons-ssl
48 | Active | 30 | 0.14.0 | Apache Mina SSHD :: Core
49 | Active | 30 | 0.2.1 | JLEdit :: Core
50 | Active | 20 | 5.0.4 | ASM all classes with
debug info
51 | Active | 5 | 2.4.7 | OPS4J Pax Url - wrap:
52 | Active | 30 | 2.0.6 | Apache Felix
Declarative Services
53 | Active | 30 | 1.0.4 | Apache Felix
Declarative Services Compatibility Extension
54 | Active | 30 | 4.0.7 | Apache Karaf :: SCR ::
Shell Commands
55 | Active | 30 | 4.0.7 | Apache Karaf :: SCR ::
Management MBeans
56 | Active | 80 | 3.2.0.201605172008 | biz.aQute.remote.agent
872 | Active | 80 | 1.0.1 | Apache Felix Log Service
873 | Active | 80 | 1.0.0.201611181055 |
com.telensa.apps.planet.pc.provider
874 | Active | 80 | 1.0.0.201611181057 |
com.telensa.apps.planet.ws.application
876 | Active | 80 | 3.2.0 | Apache Felix Http Jetty
877 | Active | 80 | 1.1.2 | Apache Felix Servlet API
878 | Active | 80 | 2.0.2 | Apache Felix Declarative
Services
879 | Active | 80 | 9.3.8.v20160314 | Jetty :: Utilities
880 | Active | 80 | 9.3.8.v20160314 | Jetty :: Utilities ::
Ajax(JSON)
881 | Active | 80 | 2.0.0.201610141744 |
osgi.enroute.executor.simple.provider
882 | Active | 80 | 2.0.0.201610141744 |
osgi.enroute.logger.simple.provider
883 | Active | 80 | 2.0.0.201610141745 |
osgi.enroute.web.simple.provider
884 | Active | 80 | 1.3.100.v20150410-1453 | Coordinator
885 | Active | 80 | 2.0.0.201610141744 |
osgi.enroute.configurer.simple.provider
887 | Active | 80 | 1.5.100.v20140428-1446 | Supplemental Equinox
Functionality
888 | Active | 80 | 1.4.8 | Apache Felix EventAdmin

The two with com.telensa.* are my code.
Post by Tim Ward
Post by Achim Nierbeck
In combination with the thread on the bnd-tools or osgi-dev I've been
under the impression that you already tried to
tweak on certain configurational aspects.
Yes, I have been trying for some time to get at various aspects of
Jetty configuration, and on making no progress at osgi-dev I was
finally told "oh, if you're using Karaf that's out of scope for this
list, try the Karaf list".
Post by Achim Nierbeck
Therefore I tried to suggest to start with a vanilla instance so we
can proceed from there.
Sorry, I still don't know what you mean by "vanilla instance".
I downloaded and installed Karaf.
I wrote a couple of servlets using bndtools.
I am now trying to debug them using the instructions in
http://enroute.osgi.org/appnotes/bndtools-and-karaf.html.
If I leave out any of the above I've no longer got anything I can run
to test whether or not I've managed to switch on Jetty request logging.
Post by Achim Nierbeck
For instance this time it's your first statement about which bundles
you actually did install yourself. As I'm not capable of
reading mind I have no clue what so ever you have been trying before
and which bundles have been installed.
As per http://enroute.osgi.org/appnotes/bndtools-and-karaf.html plus
the stuff I've written myself.
Post by Achim Nierbeck
regards, Achim
I'm not sure which thread I just responded before.
But best to start with a fresh Vanilla Karaf first.
What do you mean by that? - as far as I know I have downloaded
and installed Karaf, then installed a couple of tiny bundles of
my own so that I've got a servlet to run. How could it be much
more "vanilla" than that?
I fear with all those tryings of you to somehow configure the
server, it's not possible to
help via mailinglist ...
regards, Achim
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Tim Ward
Achim Nierbeck
2016-11-18 16:11:23 UTC
Permalink
There you go ... a crucial missing part I wasn't aware of :)

I wrote a couple of servlets using bndtools.
Post by Tim Ward
I am now trying to debug them using the instructions in
http://enroute.osgi.org/appnotes/bndtools-and-karaf.html.
I have not the slightest Idea about what bndtools actually does when
"providing" the bundles to Karaf.
I fear lots of the confusion and of course of the failures are due to
bndtools actually providing extra bundles not needed when running inside
Karaf.

So let's start from scratch then. As I haven't used bndtools for
provisioning, I can't help on that, but I can help you with Karaf ;)

Is your project capable of producing maven accessible bundles?
Cause the most easiest way of using Karaf is to actually deploy bundles
with a maven coordinate.

If you use a Vanilla Karaf, you first need to install the http service
(Pax-Web)
via:

feature:install war

now you can install a sample servlet application like

bundle:install -s mvn:org.ops4j.pax.web.samples/whiteboard-blueprint/4.3.2/

this will give you a running servlet application on port 8181

http://127.0.0.1:8181/

you'll find the corresponding integration test at [1].

regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-karaf/src/test/java/org/ops4j/pax/web/itest/karaf/WhiteboardKarafTest.java
Post by Tim Ward
In combination with the thread on the bnd-tools or osgi-dev I've been
under the impression that you already tried to
tweak on certain configurational aspects.
Yes, I have been trying for some time to get at various aspects of Jetty
configuration, and on making no progress at osgi-dev I was finally told
"oh, if you're using Karaf that's out of scope for this list, try the Karaf
list".
Therefore I tried to suggest to start with a vanilla instance so we can
proceed from there.
Sorry, I still don't know what you mean by "vanilla instance".
I downloaded and installed Karaf.
I wrote a couple of servlets using bndtools.
I am now trying to debug them using the instructions in
http://enroute.osgi.org/appnotes/bndtools-and-karaf.html.
If I leave out any of the above I've no longer got anything I can run to
test whether or not I've managed to switch on Jetty request logging.
For instance this time it's your first statement about which bundles you
actually did install yourself. As I'm not capable of
reading mind I have no clue what so ever you have been trying before and
which bundles have been installed.
As per http://enroute.osgi.org/appnotes/bndtools-and-karaf.html plus the
stuff I've written myself.
regards, Achim
Post by Tim Ward
Post by Achim Nierbeck
I'm not sure which thread I just responded before.
But best to start with a fresh Vanilla Karaf first.
What do you mean by that? - as far as I know I have downloaded and
installed Karaf, then installed a couple of tiny bundles of my own so that
I've got a servlet to run. How could it be much more "vanilla" than that?
I fear with all those tryings of you to somehow configure the server,
Post by Achim Nierbeck
it's not possible to
help via mailinglist ...
regards, Achim
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Achim Nierbeck
2016-11-18 16:12:56 UTC
Permalink
Ok,
Post by Tim Ward
872 | Active | 80 | 1.0.1 | Apache Felix Log Service
873 | Active | 80 | 1.0.0.201611181055 | com.telensa.apps.planet.pc.
provider
874 | Active | 80 | 1.0.0.201611181057 | com.telensa.apps.planet.ws
.application
876 | Active | 80 | 3.2.0 | Apache Felix Http Jetty
877 | Active | 80 | 1.1.2 | Apache Felix Servlet API
878 | Active | 80 | 2.0.2 | Apache Felix Declarative
Services
879 | Active | 80 | 9.3.8.v20160314 | Jetty :: Utilities
Ajax(JSON)
881 | Active | 80 | 2.0.0.201610141744 |
osgi.enroute.executor.simple.provider
882 | Active | 80 | 2.0.0.201610141744 | osgi.enroute.logger.simple.
provider
883 | Active | 80 | 2.0.0.201610141745 | osgi.enroute.web.simple.
provider
884 | Active | 80 | 1.3.100.v20150410-1453 | Coordinator
885 | Active | 80 | 2.0.0.201610141744 | osgi.enroute.configurer.
simple.provider
887 | Active | 80 | 1.5.100.v20140428-1446 | Supplemental Equinox
Functionality
888 | Active | 80 | 1.4.8 | Apache Felix EventAdmin
all of those services besides 873 and 874 are not needed in the scope of
Karaf ...
... well maybe 881 to 885

regards, Achim
Post by Tim Ward
There you go ... a crucial missing part I wasn't aware of :)
I wrote a couple of servlets using bndtools.
Post by Tim Ward
I am now trying to debug them using the instructions in
http://enroute.osgi.org/appnotes/bndtools-and-karaf.html.
I have not the slightest Idea about what bndtools actually does when
"providing" the bundles to Karaf.
I fear lots of the confusion and of course of the failures are due to
bndtools actually providing extra bundles not needed when running inside
Karaf.
So let's start from scratch then. As I haven't used bndtools for
provisioning, I can't help on that, but I can help you with Karaf ;)
Is your project capable of producing maven accessible bundles?
Cause the most easiest way of using Karaf is to actually deploy bundles
with a maven coordinate.
If you use a Vanilla Karaf, you first need to install the http service
(Pax-Web)
feature:install war
now you can install a sample servlet application like
bundle:install -s mvn:org.ops4j.pax.web.samples/whiteboard-blueprint/
4.3.2/
this will give you a running servlet application on port 8181
http://127.0.0.1:8181/
you'll find the corresponding integration test at [1].
regards, Achim
[1] - https://github.com/ops4j/org.ops4j.pax.web/blob/master/
pax-web-itest/pax-web-itest-karaf/src/test/java/org/ops4j/
pax/web/itest/karaf/WhiteboardKarafTest.java
Post by Tim Ward
In combination with the thread on the bnd-tools or osgi-dev I've been
under the impression that you already tried to
tweak on certain configurational aspects.
Yes, I have been trying for some time to get at various aspects of Jetty
configuration, and on making no progress at osgi-dev I was finally told
"oh, if you're using Karaf that's out of scope for this list, try the Karaf
list".
Therefore I tried to suggest to start with a vanilla instance so we can
proceed from there.
Sorry, I still don't know what you mean by "vanilla instance".
I downloaded and installed Karaf.
I wrote a couple of servlets using bndtools.
I am now trying to debug them using the instructions in
http://enroute.osgi.org/appnotes/bndtools-and-karaf.html.
If I leave out any of the above I've no longer got anything I can run to
test whether or not I've managed to switch on Jetty request logging.
For instance this time it's your first statement about which bundles you
actually did install yourself. As I'm not capable of
reading mind I have no clue what so ever you have been trying before and
which bundles have been installed.
As per http://enroute.osgi.org/appnotes/bndtools-and-karaf.html plus the
stuff I've written myself.
regards, Achim
Post by Tim Ward
Post by Achim Nierbeck
I'm not sure which thread I just responded before.
But best to start with a fresh Vanilla Karaf first.
What do you mean by that? - as far as I know I have downloaded and
installed Karaf, then installed a couple of tiny bundles of my own so that
I've got a servlet to run. How could it be much more "vanilla" than that?
I fear with all those tryings of you to somehow configure the server,
Post by Achim Nierbeck
it's not possible to
help via mailinglist ...
regards, Achim
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
& Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Tim Ward
2016-11-18 15:38:38 UTC
Permalink
I tried with only

org.ops4j.pax.web.log.ncsa.
enabled = true

and no log file appeared anywhere I could find.
Post by Achim Nierbeck
hmm ...
as it's windows and it's always a hard time to write to files on
windows ...
could you experiment with the directory a bit.
it could also be
c:\\karaf
sorry it's been quite a long time since the last time I used windows.
OTH you might just leave it alone.
One way would be to start slow with only setting the
org.ops4j.pax.web.log.ncsa.enabled = true
in the configuration.
The log file should be appended to $KARAF_HOME/logs if nothing else is
configured.
Usually you also find a log message in the logs, telling where it
regards, Achim
Ah, thank you.
(1) That wasn't clear from any documentation I found.
(2) I would have hoped to get an error message in the log if I'd
coded it wrongly?
(3) And it still doesn't work: I now have
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format = yyyy_mm_dd.request.log
org.ops4j.pax.web.log.ncsa.directory = c:/karaf/access/
but still no log file being created in c:\karaf\access.
Post by Jean-Baptiste Onofré
Hi Tim,
the format is wrong.
You need to set the format, but not the file to write to.
If you want to write to another directory you need to set the following
org.ops4j.pax.web.log.ncsa.directory=c:/karaf/access/
regards, Achim
Yes, I've tried various versions of those things, and they
don't work for me.
I've just tried again, and it didn't work again.
(1) I put
org.ops4j.pax.web.log.ncsa.enabled = true
org.ops4j.pax.web.log.ncsa.format =
c:\\karaf\\access\\yyyy_mm_dd.request.log
into my org.ops4j.pax.web.cfg.
(2) Something appears to have noticed that this file has
changed, as witness
2016-11-18 14:55:28,880 | DEBUG | karaf\bin\..\etc |
configadmin | 3 - org.apache.felix.configadmin - 1.8.8 |
getProperties()
2016-11-18 14:55:28,881 | INFO | karaf\bin\..\etc |
fileinstall | 4 - org.apache.felix.fileinstall - 3.5.4 |
Updating configuration from org.ops4j.pax.web.cfg
2016-11-18 14:55:28,889 | DEBUG | g.ops4j.pax.web) |
configadmin | 3 - org.apache.felix.configadmin - 1.8.8 |
getProperties()
(3) I made sure the directory c:\karaf\access existed, just
in case the logging code doesn't create its own directories.
(4) I made a request of the web server, which returned a
response to the browser. Checking the DEBUG level messages in
the Karaf log confirms that it did handle the request.
(5) No log file appeared in c:\karaf\access.
Post by Jean-Baptiste Onofré
Hi Tim,
in [1], you'll find the current configurations available.
a configuration.json will not be used by pax-web. You have
to use the org.ops4j.pax.web.cfg as it's used to feed
the ConfigurationAdmin service. Those properties are then
propagated to the corresponding OSGi service.
Regarding NCSA logger, yes it's possible, just configure it
appropriately. We have a test for it, which is disabled right now
as we have some "file" race-conditions on it. [2]
A full list of possible configurations can also be found here [3]
regards, Achim
[1] -
http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#basic-configuration
<http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html#basic-configuration>
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpServiceIntegrationTest.java#L405-L437
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/HttpServiceIntegrationTest.java#L405-L437>
[3] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-runtime/src/main/resources/OSGI-INF/metatype/metatype.xml>
Post by Achim Nierbeck
Oh and one more thing, which might be different.
Per default, jetty doesn't listen on port 8181 unless
there is at least one application capable of listening
to it.
It's been a feature request in the past.
I'm sorry, I don't understand that. I have deliberately
set it to 8181 using configuration.json, and it works -
my servlets respond on 8181, before I did this the
default was 8080.
Post by Achim Nierbeck
regards, Achim
2016-11-18 15:27 GMT+01:00 Achim Nierbeck
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found
here [1].
Also keep in mind, as Pax-Web is a HttpService it's
configuration should first be configured by the
HttpService configuration,
found in the org.ops4j.pax.web config file, like
port etc.
Only for enhanced configurations you should use
jetty.xml.
Another point here, the jetty.xml uses some slight
different configuration syntax, as you configure an
already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Callname="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
regards, Achim
[1] -
http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
<http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html>
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml
<https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml>
2016-11-18 15:16 GMT+01:00 Jean-Baptiste Onofré
Hi Tim,
when you install the jetty feature, you can
override the default configuration using
etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Very simple, I hope, but days of research
haven't found an answer that
works yet.
How do change the configuration of Jetty in
Karaf? As the simplest
possible initial beginner's question, how
do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with
requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg
and then looking in
data\log\karaf.log, but given the volume
and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log
in
org.ops4j.paw.web.cfg but that doesn't seen
to do anything.
I've tried creating a gibberish jetty.xml,
pointed to by
org.ops4j.pax.web.config.file in
org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the
gibberish, showing that at least
something was reading the jetty.xml, but
that didn't work. It didn't
work doing the same via configuration.json
either.
I haven't really found any actual
*documentation* of any of the above,
just snippets of example code, so all my
attempts were probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web
<http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook
<http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web
<http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/
<http://wiki.ops4j.org/display/paxweb/Pax+Web/>> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
Tim Ward
2016-11-18 14:41:25 UTC
Permalink
Post by Jean-Baptiste Onofré
Hi Tim,
as JB already said, that's part of the configuration.
For more details on how to use Pax-Web can be found here [1].
I tried that, setting some of the |org.ops4j.pax.web.log.ncsa.*|
properties, it didn't work. *Exactly* what properties do I have to set
to turn on request logging?
Post by Jean-Baptiste Onofré
Also keep in mind, as Pax-Web is a HttpService it's configuration
should first be configured by the HttpService configuration,
found in the org.ops4j.pax.web config file, like port etc.
Yes, I've managed to set the port, via configuration\configuration.json.

I don't mind where or how I set configuration, I'm quite prepared to
take advice on doing it the "best" or "correct" way, but at present I
don't have *any* way at all that actually works, which is why I'm
clutching at all the straws I can find on the web.
Post by Jean-Baptiste Onofré
Only for enhanced configurations you should use jetty.xml.
Another point here, the jetty.xml uses some slight different
configuration syntax, as you configure an already startet
Jetty instead of configuring a fresh Jetty.
For example do
<Callname="addConnector">
or
<Get name="handler">
<Call name="addHandler">
to adapt the configuration.
A complete jetty.xml can be found here [2].
Yes, I found that, but what I haven't found is an example telling me how
to turn on request logging.

And I really did think that putting deliberate errors into the jetty.xml
would cause errors to be reported, and that, therefore, the lack of any
errors being reported indicated that the jetty.xml wasn't being read by
anything. which would be consistent with the ncsa properties not working
either if nothing were reading the entire org.ops4j.pax.web.cfg file.
Post by Jean-Baptiste Onofré
regards, Achim
[1] - http://ops4j.github.io/pax/web/SNAPSHOT/User-Guide.html
[2] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/src/main/resources/jetty.xml
Hi Tim,
when you install the jetty feature, you can override the default
configuration using etc/org.ops4j.pax.web.cfg.
org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty.xml
Then the etc/jetty.xml is a jetty file.
Regards
JB
Very simple, I hope, but days of research haven't found an answer that
works yet.
How do change the configuration of Jetty in Karaf? As the simplest
possible initial beginner's question, how do I turn on request logging?
The osgi-dev mailing list referred me here.
(I can actually see what it's doing with requests by setting the log
level to DEBUG in org.ops4j.pax.logging.cfg and then looking in
data\log\karaf.log, but given the volume and format of output that's not
a practical solution.
I've tried putting stuff like
org.ops4j.pax.web.log.ncsa.format=yyyy_mm_dd.request.log in
org.ops4j.paw.web.cfg but that doesn't seen to do anything.
I've tried creating a gibberish jetty.xml, pointed to by
org.ops4j.pax.web.config.file in org.ops4j.paw.web.cfg, in the hope of
getting some error messages about the gibberish, showing that at least
something was reading the jetty.xml, but that didn't work. It didn't
work doing the same via configuration.json either.
I haven't really found any actual *documentation* of any of the above,
just snippets of example code, so all my attempts were
probably wrong
anyway.)
--
Tim Ward
--
Jean-Baptiste Onofré
http://blog.nanthrax.net
Talend - http://www.talend.com
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
--
Tim Ward
Loading...