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.
On 18/11/2016 15:14, Achim Nierbeck wrote:
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
2016-11-18 16:00 GMT+01:00 Tim Ward <[email protected]
<mailto:[email protected]>>:
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.
On 18/11/2016 14:51, Achim Nierbeck wrote:
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>
2016-11-18 15:43 GMT+01:00 Tim Ward <[email protected]
<mailto:[email protected]>>:
On 18/11/2016 14:28, Achim Nierbeck wrote:
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
2016-11-18 15:27 GMT+01:00 Achim Nierbeck
<[email protected] <mailto:[email protected]>>:
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é
<[email protected] <mailto:[email protected]>>:
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
On 11/18/2016 03:11 PM, Tim Ward wrote:
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é
[email protected] <mailto:[email protected]>
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