Copying jetty-centralized-logging from /sandbox/ into place.

* Removing tests/test-webapps/test-webapp-logging-* which are now in place in the jetty-centralized-logging project.



git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@836 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Joakim Erdfelt 2009-09-08 20:46:49 +00:00
parent db1479e571
commit 6c4b06bbce
64 changed files with 4565 additions and 135 deletions

9
jetty-centralized-logging/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
target/
.classpath
.project
.settings
*.swp
*.patch
*.diff
*.log
cobertura.ser

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -0,0 +1,853 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="976"
height="776"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
sodipodi:docname="jetty_centralized_logging.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.0"
inkscape:export-filename="/home/joakim/code/webtide/jetty7-git/sandbox/jetty-centralized-logging/docs/jetty_centralized_logging.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4">
<marker
inkscape:stockid="Arrow2Lstart"
orient="auto"
refY="0"
refX="0"
id="Arrow2Lstart"
style="overflow:visible">
<path
id="path3260"
style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z"
transform="matrix(1.1,0,0,1.1,1.1,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow2Lend"
style="overflow:visible">
<path
id="path3263"
style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.97309,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z"
transform="matrix(-1.1,0,0,-1.1,-1.1,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lend"
style="overflow:visible">
<path
id="path3245"
d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
transform="matrix(-0.8,0,0,-0.8,-10,0)" />
</marker>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="10"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.98994949"
inkscape:cx="457.39199"
inkscape:cy="414.74052"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1920"
inkscape:window-height="1151"
inkscape:window-x="0"
inkscape:window-y="0"
showguides="true"
inkscape:guide-bbox="true"
inkscape:snap-bbox="true"
inkscape:object-nodes="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true">
<inkscape:grid
type="xygrid"
id="grid3199"
visible="true"
enabled="true"
spacingx="5px"
spacingy="5px"
dotted="false" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0.5,10.5)">
<rect
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8520"
width="975"
height="775"
x="0"
y="-10" />
<rect
style="fill:#fadcb5;fill-opacity:1;stroke:#000000;stroke-width:1.00000012;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8424"
width="148.95634"
height="59.432926"
x="566.04364"
y="605" />
<rect
y="446.35019"
x="566.04364"
height="138.59357"
width="148.95634"
id="rect8400"
style="fill:#fdefdc;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="fill:#b2d8fa;fill-opacity:1;stroke:#000000;stroke-width:0.99999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8207"
width="149"
height="119.2994"
x="75.5"
y="190.50002" />
<rect
style="fill:#65b0f4;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3193"
width="148.95634"
height="48.956337"
x="75.521828"
y="90.521828" />
<text
xml:space="preserve"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="109.91553"
y="120.71484"
id="text3195"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan3197"
x="109.91553"
y="120.71484">Webapp</tspan></text>
<g
id="g8225"
transform="translate(4.3651352,5.780426)">
<rect
y="194.21957"
x="80.634865"
height="48.974144"
width="59.500004"
id="rect3207"
style="fill:#65b0f4;fill-opacity:1;stroke:#000000;stroke-width:1.00000012;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="92.064064"
y="223.91661"
id="text3203"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan3205"
x="92.064064"
y="223.91661">Log</tspan></text>
</g>
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="155"
y="220"
id="text3225"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
x="155"
y="220"
id="tspan3229">log4j.jar</tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-opacity:1"
d="M 225,235 C 324.93709,225.87435 322.50253,126.37925 225,115"
id="path3233"
sodipodi:nodetypes="cc" />
<text
sodipodi:linespacing="100%"
id="text8195"
y="175"
x="240"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="175"
x="240"
sodipodi:role="line"
id="tspan8199">provides</tspan></text>
<path
sodipodi:nodetypes="cc"
id="path8203"
d="M 110.56289,198.03968 L 110.56289,139.98412"
style="fill:#1616f0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="115"
y="170"
id="text8221"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8223"
x="115"
y="170">Emit Log</tspan></text>
<text
sodipodi:linespacing="100%"
id="text8230"
y="275"
x="85"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="275"
x="85"
id="tspan8232"
sodipodi:role="line">Logger Configuration</tspan></text>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="85"
y="295"
id="text8234"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8236"
x="85"
y="295">Log Appender</tspan></text>
<path
style="fill:#1616f0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 111.57304,328.38173 L 111.57304,249.97416"
id="path8238"
sodipodi:nodetypes="cc" />
<rect
y="330"
x="75"
height="48.974144"
width="149.5"
id="rect8242"
style="fill:#65b0f4;fill-opacity:1;stroke:#000000;stroke-width:1.00000012;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="111.89453"
y="360.2019"
id="text8244"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8246"
x="111.89453"
y="360.2019">Log File</tspan></text>
<g
id="g8341">
<rect
style="fill:#fab5b5;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8251"
width="148.95634"
height="68.956329"
x="75.5"
y="400.54364" />
<text
xml:space="preserve"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="93.044579"
y="432.27179"
id="text8253"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8255"
x="93.044579"
y="432.27179">Webapp</tspan><tspan
id="tspan8257"
sodipodi:role="line"
x="93.044579"
y="454.27179">Classloader</tspan></text>
</g>
<g
id="g8336">
<rect
y="490.32645"
x="75.543655"
height="49.173546"
width="148.95634"
id="rect8259"
style="fill:#fab5b5;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
sodipodi:linespacing="100%"
id="text8261"
y="520.23596"
x="95.021828"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="520.23596"
x="95.021828"
sodipodi:role="line"
id="tspan8265">Jetty Server</tspan></text>
</g>
<rect
y="190.50003"
x="401"
height="118.99996"
width="149"
id="rect8269"
style="fill:#b2d8fa;fill-opacity:1;stroke:#000000;stroke-width:0.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
y="90.521835"
x="401.02182"
height="48.956337"
width="148.95634"
id="rect8271"
style="fill:#65b0f4;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
sodipodi:linespacing="100%"
id="text8273"
y="120.71484"
x="475.38721"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="120.71484"
x="475.38721"
id="tspan8275"
sodipodi:role="line">Webapp A</tspan></text>
<g
transform="translate(329.86514,5.7804336)"
id="g8277">
<rect
style="fill:#65b0f4;fill-opacity:1;stroke:#000000;stroke-width:1.00000012;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8279"
width="59.500004"
height="48.974144"
x="80.634865"
y="194.21957" />
<text
sodipodi:linespacing="100%"
id="text8281"
y="223.91661"
x="92.064064"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="223.91661"
x="92.064064"
id="tspan8283"
sodipodi:role="line">Log</tspan></text>
</g>
<text
sodipodi:linespacing="100%"
id="text8285"
y="220"
x="480.5"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
id="tspan8287"
y="220"
x="480.5"
sodipodi:role="line">log4j</tspan></text>
<path
sodipodi:nodetypes="cc"
id="path8289"
d="M 550,215 C 650,227.14286 640,310 640,365"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="578.81055"
y="291.63672"
id="text8291"
sodipodi:linespacing="100%"><tspan
id="tspan8293"
sodipodi:role="line"
x="578.81055"
y="291.63672">provides</tspan></text>
<path
style="fill:#1616f0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 436.06289,198.03969 L 436.06289,139.98413"
id="path8295"
sodipodi:nodetypes="cc" />
<text
sodipodi:linespacing="100%"
id="text8297"
y="170"
x="440.5"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="170"
x="440.5"
id="tspan8299"
sodipodi:role="line">Emit Log</tspan></text>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="578.1712"
y="465"
id="text8301"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8303"
x="578.1712"
y="465">Log Routing Classes</tspan></text>
<rect
style="fill:#fadcb5;fill-opacity:1;stroke:#000000;stroke-width:1.00000012;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8311"
width="149.5"
height="48.974144"
x="565.5"
y="680" />
<text
sodipodi:linespacing="100%"
id="text8313"
y="710.2019"
x="602.39453"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="710.2019"
x="602.39453"
id="tspan8315"
sodipodi:role="line">Log File</tspan></text>
<g
id="g8432"
transform="translate(-4.3670654e-2,0)">
<rect
y="365.5"
x="400.54367"
height="68.956329"
width="148.95634"
id="rect8317"
style="fill:#fab5b5;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
sodipodi:linespacing="100%"
id="text8319"
y="397.22815"
x="474.56531"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="397.22815"
x="474.56531"
id="tspan8321"
sodipodi:role="line">Webapp</tspan><tspan
y="419.22815"
x="474.56531"
sodipodi:role="line"
id="tspan8323">Classloader</tspan></text>
</g>
<g
id="g8331"
transform="translate(-4.3670654e-2,-35.04364)">
<rect
style="fill:#fab5b5;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8325"
width="148.95634"
height="49.173546"
x="401.04367"
y="490.32645" />
<text
xml:space="preserve"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="420.52182"
y="520.23596"
id="text8327"
sodipodi:linespacing="100%"><tspan
id="tspan8329"
sodipodi:role="line"
x="420.52182"
y="520.23596">Jetty Server</tspan></text>
</g>
<path
sodipodi:nodetypes="cc"
id="path8364"
d="M 550,202.14286 C 649.93709,193.01721 647.50253,126.37925 550,115"
style="opacity:0.33333333;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ff1919;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
x="613.06055"
y="150.63672"
id="text8366"
sodipodi:linespacing="100%"><tspan
id="tspan8368"
sodipodi:role="line"
x="613.06055"
y="150.63672">DISABLED</tspan></text>
<text
sodipodi:linespacing="100%"
id="text8370"
y="190"
x="600"
style="font-size:32px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ff1919;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
xml:space="preserve"><tspan
y="190"
x="600"
sodipodi:role="line"
id="tspan8372">X</tspan></text>
<g
id="g8386"
transform="translate(5.5,0.5)">
<rect
y="365"
x="560"
height="69.5"
width="149"
id="rect8374"
style="fill:#fadcb5;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
sodipodi:linespacing="100%"
id="text8376"
y="394.46484"
x="634.76318"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="394.46484"
x="634.76318"
id="tspan8378"
sodipodi:role="line">Centralized</tspan><tspan
id="tspan8380"
y="416.46484"
x="634.76318"
sodipodi:role="line">Logging</tspan></text>
</g>
<text
sodipodi:linespacing="100%"
id="text8402"
y="630.44061"
x="640.70197"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="630.44061"
x="640.70197"
id="tspan8404"
sodipodi:role="line">Global slf4J</tspan><tspan
y="648.44061"
x="640.70197"
sodipodi:role="line"
id="tspan8426">Configuration</tspan></text>
<rect
rx="14.324922"
ry="14.324921"
y="475.5"
x="571.04364"
height="28.649841"
width="138.45636"
id="rect8406"
style="fill:#fadcb5;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
sodipodi:linespacing="100%"
id="text8408"
y="494.14984"
x="585"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="494.14984"
x="585"
sodipodi:role="line"
id="tspan8410">slf4j-log4j.jar</tspan></text>
<rect
style="fill:#fadcb5;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8412"
width="138.45636"
height="28.649841"
x="571.54364"
y="510"
ry="14.324921"
rx="14.324922" />
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="585.5"
y="528.64984"
id="text8414"
sodipodi:linespacing="100%"><tspan
id="tspan8416"
sodipodi:role="line"
x="585.5"
y="528.64984">slf4j-clogging.jar</tspan></text>
<rect
rx="14.324922"
ry="14.324921"
y="545"
x="571.54364"
height="28.649841"
width="138.45636"
id="rect8418"
style="fill:#fadcb5;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
sodipodi:linespacing="100%"
id="text8420"
y="563.64984"
x="585.5"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="563.64984"
x="585.5"
sodipodi:role="line"
id="tspan8422">slf4j-julogging.jar</tspan></text>
<path
sodipodi:nodetypes="ccccc"
id="path8309"
d="M 580,680 L 580,605 C 540,600 545,490 575,480 C 550,470 550,380 590,365 C 535,345 445.35714,313.92857 440,250"
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
sodipodi:linespacing="100%"
id="text8428"
y="334.86328"
x="523.81055"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="334.86328"
x="523.81055"
sodipodi:role="line"
id="tspan8430">route</tspan></text>
<rect
style="fill:#b2d8fa;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8438"
width="149"
height="119.0218"
x="730.5"
y="190.4782" />
<rect
style="fill:#65b0f4;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8440"
width="148.95634"
height="48.956337"
x="730.52185"
y="90.5" />
<text
xml:space="preserve"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="804.88721"
y="120.69299"
id="text8442"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8444"
x="804.88721"
y="120.69299">Webapp B</tspan></text>
<g
id="g8446"
transform="translate(724.86513,5.780426)">
<rect
y="194.21957"
x="80.634865"
height="48.974144"
width="59.500004"
id="rect8448"
style="fill:#65b0f4;fill-opacity:1;stroke:#000000;stroke-width:1.00000012;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="92.064064"
y="223.91661"
id="text8450"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8452"
x="92.064064"
y="223.91661">Log</tspan></text>
</g>
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="745.59766"
y="218.67578"
id="text8454"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
x="745.59766"
y="218.67578"
id="tspan8456">j.u.log</tspan></text>
<path
sodipodi:nodetypes="cc"
id="path8458"
d="M 839.30406,198.51189 L 839.30406,140.45633"
style="fill:#1616f0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="778.63965"
y="170.31543"
id="text8460"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8462"
x="778.63965"
y="170.31543">Emit Log</tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-opacity:1"
d="M 730,215 C 630,227.14286 640,310 640,365"
id="path8464"
sodipodi:nodetypes="cc" />
<text
sodipodi:linespacing="100%"
id="text8466"
y="290"
x="650"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="290"
x="650"
sodipodi:role="line"
id="tspan8468">provides</tspan></text>
<path
style="opacity:0.33333333;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-opacity:1"
d="M 729.54267,202.64286 C 629.60558,193.51721 632.04014,126.87925 729.54267,115.5"
id="path8470"
sodipodi:nodetypes="cc" />
<text
xml:space="preserve"
style="font-size:32px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ff1919;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
x="655"
y="190"
id="text8476"
sodipodi:linespacing="100%"><tspan
id="tspan8478"
sodipodi:role="line"
x="655"
y="190">X</tspan></text>
<path
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Lstart);marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 700,680 L 700,605 C 740,600 740,565 710,555 C 735,545 730,380 690,365 C 745,345 834.64286,313.92857 840,250"
id="path8480"
sodipodi:nodetypes="ccccc" />
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="720"
y="335"
id="text8482"
sodipodi:linespacing="100%"><tspan
id="tspan8484"
sodipodi:role="line"
x="720"
y="335">route</tspan></text>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;opacity:0.49099103;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="408.63965"
y="271.63672"
id="text8486"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8488"
x="408.63965"
y="271.63672">Logger Configuration</tspan></text>
<text
sodipodi:linespacing="100%"
id="text8490"
y="291.63672"
x="408.63965"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;opacity:0.49099103;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="291.63672"
x="408.63965"
id="tspan8492"
sodipodi:role="line">Log Appender</tspan></text>
<text
sodipodi:linespacing="100%"
id="text8494"
y="486.4751"
x="274.09787"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ff1919;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
xml:space="preserve"
transform="matrix(0.8770636,-0.4803743,0.4803743,0.8770636,0,0)"><tspan
y="486.4751"
x="274.09787"
sodipodi:role="line"
id="tspan8496">DISABLED</tspan></text>
<text
sodipodi:linespacing="100%"
id="text8498"
y="271.63672"
x="738.63965"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;opacity:0.49099103;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
xml:space="preserve"><tspan
y="271.63672"
x="738.63965"
id="tspan8500"
sodipodi:role="line">Logger Configuration</tspan></text>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;opacity:0.49099103;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
x="738.63965"
y="291.63672"
id="text8502"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8504"
x="738.63965"
y="291.63672">Log Appender</tspan></text>
<text
transform="matrix(0.8770636,-0.4803743,0.4803743,0.8770636,0,0)"
xml:space="preserve"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ff1919;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
x="518.89191"
y="620.5506"
id="text8506"
sodipodi:linespacing="100%"><tspan
id="tspan8508"
sodipodi:role="line"
x="518.89191"
y="620.5506">DISABLED</tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 350,15 L 350,740"
id="path8510"
sodipodi:nodetypes="cc" />
<text
xml:space="preserve"
style="font-size:24px;font-style:oblique;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold Oblique"
x="53.538086"
y="51.832302"
id="text8512"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
id="tspan8514"
x="53.538086"
y="51.832302">Traditional Logging</tspan></text>
<text
sodipodi:linespacing="100%"
id="text8516"
y="50.822147"
x="500"
style="font-size:24px;font-style:oblique;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold Oblique"
xml:space="preserve"><tspan
y="50.822147"
x="500"
id="tspan8518"
sodipodi:role="line">Centralized Logging</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
// ========================================================================
// Copyright (c) Webtide LLC
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>7.0.1-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-centralized-logging</artifactId>
<name>Jetty :: Centralized Logging</name>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>config.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
</dependency>
<!--
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.5.6</version>
</dependency>
-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>copy-fresh-webapps</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-testing-wars</id>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>dummy-webapp-logging-commons</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>dummy-webapp-logging-java</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>dummy-webapp-logging-log4j</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>dummy-webapp-logging-slf4j</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
</artifactItems>
<outputDirectory>${basedir}/src/test/resources/webapps</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,77 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
/**
* Jetty Centralized Logging bean.
*/
public class CentralizedLogging extends AbstractLifeCycle
{
private Server server;
private CentralizedWebAppLoggingConfiguration webAppConfiguration;
private String configurationFilename;
public CentralizedLogging()
{
System.err.println(CentralizedLogging.class.getName() + " <init>");
}
public String getConfigurationFilename()
{
return configurationFilename;
}
public void setConfigurationFilename(String filename)
{
this.configurationFilename = filename;
}
public Server getServer()
{
return server;
}
public void setServer(Server server)
{
this.server = server;
}
@Override
protected void doStart() throws Exception
{
CentralizedWebAppLoggingConfiguration.setLoggerConfigurationFilename(configurationFilename);
webAppConfiguration = new CentralizedWebAppLoggingConfiguration();
@SuppressWarnings("unchecked")
List<Configuration> config = (List<Configuration>)server.getAttribute(WebAppContext.SERVER_CONFIG);
if (config == null)
{
config = new ArrayList<Configuration>();
}
config.add(webAppConfiguration);
server.setAttribute(WebAppContext.SERVER_CONFIG,config);
super.doStart();
}
}

View File

@ -0,0 +1,250 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging;
import java.io.FileInputStream;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.jetty.logging.impl.CentralLoggerConfig;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Slf4jLog;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
/**
* WebAppContext {@link Configuration} for Centralized Logging.
*/
public class CentralizedWebAppLoggingConfiguration implements Configuration
{
private static boolean loggerConfigured = false;
public static CentralLoggerConfig getLoggerRoot()
{
loggerConfigured = true;
return org.slf4j.impl.StaticLoggerBinder.getSingleton().getRoot();
}
public static boolean isLoggerConfigured()
{
return loggerConfigured;
}
public static void setConfiguredLoggerRoot(CentralLoggerConfig root)
{
loggerConfigured = true;
org.slf4j.impl.StaticLoggerBinder.getSingleton().setRoot(root);
try
{
// Reset jetty logger.
Slf4jLog jettyLogger = new Slf4jLog();
Log.setLog(jettyLogger);
}
catch (Exception ignore)
{
// ignore
}
}
public static void setLoggerConfigurationFilename(String filename) throws IOException
{
FileInputStream stream = null;
try
{
stream = new FileInputStream(filename);
CentralLoggerConfig root = CentralLoggerConfig.load(stream);
setConfiguredLoggerRoot(root);
loggerConfigured = true;
}
finally
{
IO.close(stream);
}
}
public void configure(WebAppContext context) throws Exception
{
context.addSystemClass("org.apache.log4j.");
context.addSystemClass("org.slf4j.");
context.addSystemClass("org.apache.commons.logging.");
initializeJavaUtilLogRouting();
}
private static boolean javaUtilLoggingInitialized = false;
private static void initializeJavaUtilLogRouting()
{
if (javaUtilLoggingInitialized)
{
return;
}
// Get root logger.
java.util.logging.Logger rootLogger = java.util.logging.Logger.getLogger("");
// Remove all existing Handlers.
for (java.util.logging.Handler handler : rootLogger.getHandlers())
{
rootLogger.removeHandler(handler);
}
// Add our only handler.
rootLogger.addHandler(new java.util.logging.Handler()
{
@Override
public void close() throws SecurityException
{
/* do nothing */
}
@Override
public void flush()
{
/* do nothing */
}
@Override
public void publish(java.util.logging.LogRecord record)
{
org.slf4j.Logger slf4jLogger = getCentralLogger(record);
int javaLevel = record.getLevel().intValue();
// TRACE?
if (javaLevel <= java.util.logging.Level.FINEST.intValue())
{
if (slf4jLogger.isTraceEnabled())
{
String message = formatMessage(record);
slf4jLogger.trace(message,record.getThrown());
}
return;
}
// DEBUG?
if (javaLevel <= java.util.logging.Level.FINE.intValue())
{
if (slf4jLogger.isDebugEnabled())
{
String message = formatMessage(record);
slf4jLogger.debug(message,record.getThrown());
}
return;
}
// INFO?
if (javaLevel <= java.util.logging.Level.INFO.intValue())
{
if (slf4jLogger.isInfoEnabled())
{
String message = formatMessage(record);
slf4jLogger.info(message,record.getThrown());
}
return;
}
// WARN?
if (javaLevel <= java.util.logging.Level.WARNING.intValue())
{
if (slf4jLogger.isWarnEnabled())
{
String message = formatMessage(record);
slf4jLogger.warn(message,record.getThrown());
}
return;
}
// All others are ERROR
if (slf4jLogger.isErrorEnabled())
{
String message = formatMessage(record);
slf4jLogger.error(message,record.getThrown());
}
}
private String formatMessage(java.util.logging.LogRecord record)
{
// Cand be raw freeform message, or resource bundle key, or null
String raw = record.getMessage();
// Null? (easy)
if (raw == null)
{
return null;
}
// Try using resource bundle
ResourceBundle bundle = record.getResourceBundle();
if (bundle != null)
{
try
{
raw = bundle.getString(raw);
}
catch (MissingResourceException e)
{
/* ignore */
}
}
// Now blend in any (optional) parameters
// Normally we would do this in the slf4j interface,
// but that lacks the ability to do a formatted message
// and a throwable at the same time.
if (record.getParameters() != null)
{
raw = MessageFormat.format(raw,record.getParameters());
}
return raw;
}
private org.slf4j.Logger getCentralLogger(java.util.logging.LogRecord record)
{
String name = record.getLoggerName();
if (name == null)
{
name = "anonymous";
}
return org.slf4j.LoggerFactory.getLogger(name);
}
});
// Tweak levels.
rootLogger.setLevel(java.util.logging.Level.ALL);
javaUtilLoggingInitialized = true;
}
public void deconfigure(WebAppContext context) throws Exception
{
/* do nothing */
}
public void postConfigure(WebAppContext context) throws Exception
{
/* do nothing */
}
public void preConfigure(WebAppContext context) throws Exception
{
/* do nothing */
}
}

View File

@ -0,0 +1,32 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging.impl;
import java.io.IOException;
/**
* Appender for log content.
*/
public interface Appender
{
void append(String date, int ms, Severity severity, String name, String message, Throwable t) throws IOException;
void setProperty(String key, String value) throws Exception;
void open() throws IOException;
void close() throws IOException;
}

View File

@ -0,0 +1,239 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging.impl;
import java.io.IOException;
import org.eclipse.jetty.util.DateCache;
import org.slf4j.helpers.MarkerIgnoringBase;
import org.slf4j.helpers.MessageFormatter;
/**
* Centralized Logger implementation.
*/
public class CentralLogger extends MarkerIgnoringBase
{
private static final long serialVersionUID = 385001265755850685L;
private static DateCache dateCache;
private Severity level = Severity.INFO;
private String name;
private Appender appenders[];
static
{
try
{
dateCache = new DateCache("yyyy-MM-dd HH:mm:ss");
}
catch (Exception e)
{
e.printStackTrace(System.err);
}
}
protected CentralLogger(String name, Appender appenders[], Severity severity)
{
this.name = name;
this.appenders = appenders;
this.level = severity;
}
private void log(Severity severity, String message, Throwable t)
{
String now = dateCache.now();
int ms = dateCache.lastMs();
for (Appender appender : appenders)
{
try
{
appender.append(now,ms,severity,name,message,t);
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
private void logFormatted(Severity severity, String format, Object arg)
{
String msg = MessageFormatter.format(format,arg);
log(severity,msg,null);
}
private void logFormatted(Severity severity, String format, Object arg1, Object arg2)
{
String msg = MessageFormatter.format(format,arg1,arg2);
log(severity,msg,null);
}
private void logFormatted(Severity severity, String format, Object[] argArray)
{
String msg = MessageFormatter.arrayFormat(format,argArray);
log(severity,msg,null);
}
public void debug(String msg)
{
log(Severity.DEBUG,msg,null);
}
public void debug(String format, Object arg)
{
logFormatted(Severity.DEBUG,format,arg);
}
public void debug(String format, Object arg1, Object arg2)
{
logFormatted(Severity.DEBUG,format,arg1,arg2);
}
public void debug(String format, Object[] argArray)
{
logFormatted(Severity.DEBUG,format,argArray);
}
public void debug(String msg, Throwable t)
{
log(Severity.DEBUG,msg,t);
}
public void error(String msg)
{
log(Severity.ERROR,msg,null);
}
public void error(String format, Object arg)
{
logFormatted(Severity.ERROR,format,arg);
}
public void error(String format, Object arg1, Object arg2)
{
logFormatted(Severity.ERROR,format,arg1,arg2);
}
public void error(String format, Object[] argArray)
{
logFormatted(Severity.ERROR,format,argArray);
}
public void error(String msg, Throwable t)
{
log(Severity.ERROR,msg,t);
}
public void info(String msg)
{
log(Severity.INFO,msg,null);
}
public void info(String format, Object arg)
{
logFormatted(Severity.INFO,format,arg);
}
public void info(String format, Object arg1, Object arg2)
{
logFormatted(Severity.INFO,format,arg1,arg2);
}
public void info(String format, Object[] argArray)
{
logFormatted(Severity.INFO,format,argArray);
}
public void info(String msg, Throwable t)
{
log(Severity.INFO,msg,t);
}
public boolean isDebugEnabled()
{
return level.isEnabled(Severity.DEBUG);
}
public boolean isErrorEnabled()
{
return level.isEnabled(Severity.ERROR);
}
public boolean isInfoEnabled()
{
return level.isEnabled(Severity.INFO);
}
public boolean isTraceEnabled()
{
return level.isEnabled(Severity.TRACE);
}
public boolean isWarnEnabled()
{
return level.isEnabled(Severity.WARN);
}
public void trace(String msg)
{
log(Severity.TRACE,msg,null);
}
public void trace(String format, Object arg)
{
logFormatted(Severity.TRACE,format,arg);
}
public void trace(String format, Object arg1, Object arg2)
{
logFormatted(Severity.TRACE,format,arg1,arg2);
}
public void trace(String format, Object[] argArray)
{
logFormatted(Severity.TRACE,format,argArray);
}
public void trace(String msg, Throwable t)
{
log(Severity.TRACE,msg,t);
}
public void warn(String msg)
{
log(Severity.WARN,msg,null);
}
public void warn(String format, Object arg)
{
logFormatted(Severity.WARN,format,arg);
}
public void warn(String format, Object arg1, Object arg2)
{
logFormatted(Severity.WARN,format,arg1,arg2);
}
public void warn(String format, Object[] argArray)
{
logFormatted(Severity.WARN,format,argArray);
}
public void warn(String msg, Throwable t)
{
log(Severity.WARN,msg,t);
}
}

View File

@ -0,0 +1,380 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging.impl;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
/**
* Represents the CentralLoggerConfig
*/
public class CentralLoggerConfig
{
private static String between(String line, String start, String end)
{
if (line.startsWith(start) && line.endsWith(end))
{
return line.substring(start.length(),line.length() - end.length());
}
return null;
}
private static void configureAppender(Properties props, String id, Appender appender)
{
// Collect configuration fields for appender id
Pattern appenderIdRegex = Pattern.compile("^appender\\." + id + "\\.([^\\.]*)$");
Matcher match;
@SuppressWarnings("unchecked")
Enumeration<String> enNames = (Enumeration<String>)props.propertyNames();
while (enNames.hasMoreElements())
{
String name = enNames.nextElement();
match = appenderIdRegex.matcher(name);
if (match.matches())
{
String fieldName = match.group(1);
if (fieldName.equals("class"))
{
continue; // Not meant to be set.
}
String value = props.getProperty(name);
try
{
appender.setProperty(fieldName,value);
}
catch (Exception e)
{
System.err.printf("Unable to set property %s on appender %s to %s%n",fieldName,appender.getClass().getName(),value);
e.printStackTrace(System.err);
}
}
}
}
private static void dumpDetails(PrintStream out, String prefix, CentralLoggerConfig cl)
{
out.printf("%sName: %s%n",prefix,cl.name);
out.printf("%sLevel: %s%n",prefix,cl.level.name());
out.printf("%sAppenders: ",prefix);
for (Iterator<Appender> it = cl.getAppenders().iterator(); it.hasNext();)
{
out.print(it.next().getClass().getSimpleName());
if (it.hasNext())
{
out.print(", ");
}
}
out.println();
if (cl.children != null)
{
out.printf("%sChildren.count: %d%n",prefix,cl.children.size());
String childPrefix = prefix + " ";
for (Map.Entry<String, CentralLoggerConfig> entry : cl.children.entrySet())
{
out.printf("%sChild[%s]%n",prefix,entry.getKey());
dumpDetails(out,childPrefix,entry.getValue());
}
}
else
{
out.printf("%sChildren: <null>%n",prefix);
}
}
private static List<Appender> getAppenders(Properties props, String key, Map<String, Appender> declaredAppenders)
{
String value = props.getProperty(key);
if (value == null)
{
return null;
}
String ids[] = value.split(",");
List<Appender> appenders = new ArrayList<Appender>();
// ensure ids exist as declared as well.
for (int i = 0, n = ids.length; i < n; i++)
{
if (declaredAppenders.containsKey(ids[i]))
{
appenders.add(declaredAppenders.get(ids[i]));
}
else
{
System.err.println("No such Appender: " + ids[i]);
}
}
return appenders;
}
private static Map<String, Appender> getDeclaredAppenders(Properties props)
{
Set<String> ids = new TreeSet<String>();
// Collect IDs
Pattern appenderIdRegex = Pattern.compile("appender\\.([^\\.]*).class");
Matcher match;
@SuppressWarnings("unchecked")
Enumeration<String> enNames = (Enumeration<String>)props.propertyNames();
while (enNames.hasMoreElements())
{
String name = enNames.nextElement();
match = appenderIdRegex.matcher(name);
if (match.matches())
{
ids.add(match.group(1));
}
}
Map<String, Appender> appenders = new HashMap<String, Appender>();
if (ids.isEmpty())
{
return appenders;
}
// Instantiate > Configure > Open the Appenders
for (String id : ids)
{
String clazzName = props.getProperty("appender." + id + ".class");
if (clazzName == null)
{
continue; // skip
}
try
{
// Instantiate Appender
Class<?> clazzAppender = Class.forName(clazzName);
Appender appender = (Appender)clazzAppender.newInstance();
// Configure Appender
configureAppender(props,id,appender);
// Open Appender
appender.open();
appenders.put(id,appender);
}
catch (ClassNotFoundException e)
{
System.err.println("Unable to find class: " + clazzName);
e.printStackTrace(System.err);
}
catch (InstantiationException e)
{
System.err.println("Unable to Instantiate: " + clazzName);
e.printStackTrace(System.err);
}
catch (IllegalAccessException e)
{
System.err.println("Unable to Access: " + clazzName);
e.printStackTrace(System.err);
}
catch (IOException e)
{
System.err.println("Unable to open Appender: " + clazzName);
e.printStackTrace(System.err);
}
}
return appenders;
}
public static CentralLoggerConfig load(InputStream stream) throws IOException
{
Properties props = new Properties();
props.load(stream);
return load(props);
}
public static CentralLoggerConfig load(Properties props) throws IOException
{
CentralLoggerConfig root = new CentralLoggerConfig(Logger.ROOT_LOGGER_NAME);
// Default for root
root.level = Severity.INFO;
// Collect all possible appenders, by id.
Map<String, Appender> declaredAppenders = getDeclaredAppenders(props);
root.appenders = getAppenders(props,"root.appenders",declaredAppenders);
if (root.appenders == null)
{
// Default (if not specified for root)
root.appenders.add(new ConsoleAppender());
}
// Set logger & level of ROOT
root.logger = new CentralLogger(root.name,root.appenders.toArray(new Appender[] {}),root.level);
root.level = Severity.valueOf(props.getProperty("root.level"));
// Collect other configured loggers
Set<String> ids = new TreeSet<String>(); // Use TreeSet to get sort order that we need.
@SuppressWarnings("unchecked")
Enumeration<String> enNames = (Enumeration<String>)props.propertyNames();
while (enNames.hasMoreElements())
{
String name = enNames.nextElement();
String id = between(name,"logger.",".level");
if (id == null)
{
id = between(name,"logger.",".appenders");
if (id == null)
{
continue; // not something we care about
}
}
ids.add(id);
}
// Set loggers & levels of OTHER nodes
for (String id : ids)
{
System.out.println("Processing child id: " + id);
CentralLoggerConfig childlog = root.getConfiguredLogger(id);
childlog.level = Severity.valueOf(props.getProperty("logger." + id + ".level","INFO"));
childlog.addAppenders(getAppenders(props,"logger." + id + ".appenders",declaredAppenders));
}
return root;
}
private String name;
private List<Appender> appenders = new ArrayList<Appender>();
private Severity level;
private CentralLogger logger;
private Map<String, CentralLoggerConfig> children;
private CentralLoggerConfig(CentralLoggerConfig copyLogger, String name)
{
if (copyLogger.name.equals(CentralLogger.ROOT_LOGGER_NAME))
{
this.name = name;
}
else
{
this.name = copyLogger.name + "." + name;
}
this.appenders.addAll(copyLogger.appenders);
this.level = copyLogger.level;
this.logger = new CentralLogger(name,appenders.toArray(new Appender[] {}),level);
}
private CentralLoggerConfig(String name)
{
this.name = name;
}
private void addAppenders(List<Appender> moreAppenders)
{
if (moreAppenders == null)
{
return;
}
getAppenders().addAll(moreAppenders);
this.logger = new CentralLogger(name,appenders.toArray(new Appender[] {}),level);
}
public void dumpTree(PrintStream out)
{
dumpDetails(out,"",this);
}
public Appender findAppender(Class<? extends Appender> clazz)
{
for (Appender appender : appenders)
{
if (clazz.isAssignableFrom(appender.getClass()))
{
return appender;
}
}
return null;
}
public List<Appender> getAppenders()
{
return appenders;
}
private CentralLoggerConfig getChildLogger(String name)
{
CentralLoggerConfig child = getChildren().get(name);
if (child == null)
{
child = new CentralLoggerConfig(this,name);
this.children.put(name,child);
}
return child;
}
public Map<String, CentralLoggerConfig> getChildren()
{
if (children == null)
{
children = new HashMap<String, CentralLoggerConfig>();
}
return children;
}
public CentralLoggerConfig getConfiguredLogger(String name)
{
String parts[] = name.split("\\.");
CentralLoggerConfig ret = this;
for (String part : parts)
{
ret = ret.getChildLogger(part);
}
return ret;
}
public Severity getLevel()
{
return level;
}
public CentralLogger getLogger()
{
return logger;
}
public String getName()
{
return name;
}
}

View File

@ -0,0 +1,59 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging.impl;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
/**
* The Logger Factory for CentralLoggers.
*/
public class CentralLoggerFactory implements ILoggerFactory
{
private CentralLoggerConfig root;
private Map<String, CentralLogger> loggers;
public CentralLoggerFactory(CentralLoggerConfig root)
{
this.root = root;
this.loggers = new HashMap<String, CentralLogger>();
}
public void setRoot(CentralLoggerConfig root)
{
this.root = root;
this.loggers.clear();
}
public Logger getLogger(String name)
{
CentralLogger ret = null;
synchronized (this)
{
ret = loggers.get(name);
if (ret == null)
{
CentralLoggerConfig clogger = root.getConfiguredLogger(name);
ret = clogger.getLogger();
loggers.put(name,ret);
}
}
return ret;
}
}

View File

@ -0,0 +1,68 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging.impl;
import java.io.IOException;
/**
* Standard Appender to the STDOUT Console
*/
public class ConsoleAppender implements Appender
{
public void append(String date, int ms, Severity severity, String name, String message, Throwable t)
{
StringBuffer buf = new StringBuffer();
buf.append(date);
if (ms > 99)
{
buf.append(".");
}
else if (ms > 0)
{
buf.append(".0");
}
else
{
buf.append(".00");
}
buf.append(ms);
buf.append(':').append(severity.name()).append(':');
buf.append(name);
buf.append(':').append(message);
System.out.println(buf.toString());
if (t != null)
{
t.printStackTrace(System.out);
}
System.out.flush();
}
public void setProperty(String key, String value) throws Exception
{
/* nothing to do here */
}
public void open() throws IOException
{
/* nothing to do here */
}
public void close() throws IOException
{
/* nothing to do here */
}
}

View File

@ -0,0 +1,176 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging.impl;
import java.io.IOException;
import java.io.PrintStream;
import java.util.TimeZone;
import org.eclipse.jetty.util.RolloverFileOutputStream;
/**
* Rolling File Appender
*/
public class RollingFileAppender implements Appender
{
private RolloverFileOutputStream out;
private String filename;
private boolean append = true;
private int retainDays = 31;
private TimeZone zone = TimeZone.getDefault();
private String dateFormat = "yyyy_MM_dd";
private String backupFormat = "HHmmssSSS";
public void append(String date, int ms, Severity severity, String name, String message, Throwable t) throws IOException
{
StringBuffer buf = new StringBuffer();
buf.append(date);
if (ms > 99)
{
buf.append(".");
}
else if (ms > 0)
{
buf.append(".0");
}
else
{
buf.append(".00");
}
buf.append(ms);
buf.append(':').append(severity.name()).append(':');
buf.append(name);
buf.append(':').append(message);
out.write(buf.toString().getBytes());
if (t != null)
{
t.printStackTrace(new PrintStream(out));
}
out.flush();
}
public void close() throws IOException
{
out.close();
}
public String getBackupFormat()
{
return backupFormat;
}
public String getDateFormat()
{
return dateFormat;
}
public String getFilename()
{
return filename;
}
public int getRetainDays()
{
return retainDays;
}
public TimeZone getZone()
{
return zone;
}
public boolean isAppend()
{
return append;
}
public void open() throws IOException
{
out = new RolloverFileOutputStream(filename,append,retainDays,zone,dateFormat,backupFormat);
}
public void setAppend(boolean append)
{
this.append = append;
}
public void setBackupFormat(String backupFormat)
{
this.backupFormat = backupFormat;
}
public void setDateFormat(String dateFormat)
{
this.dateFormat = dateFormat;
}
public void setFilename(String filename)
{
this.filename = filename;
}
public void setProperty(String key, String value) throws Exception
{
if ("filename".equals(key))
{
setFilename(value);
return;
}
if ("append".equals(key))
{
setAppend(Boolean.parseBoolean(value));
return;
}
if ("retainDays".equals(key))
{
setRetainDays(Integer.parseInt(value));
return;
}
if ("zone".equals(key))
{
setZone(TimeZone.getTimeZone(value));
return;
}
if ("dateFormat".equals(key))
{
setDateFormat(value);
return;
}
if ("backupFormat".equals(key))
{
setBackupFormat(value);
return;
}
throw new IllegalArgumentException("No such key \"" + key + "\"");
}
public void setRetainDays(int retainDays)
{
this.retainDays = retainDays;
}
public void setZone(TimeZone zone)
{
this.zone = zone;
}
}

View File

@ -0,0 +1,27 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging.impl;
public enum Severity
{
TRACE, DEBUG, INFO, WARN, ERROR;
public boolean isEnabled(Severity severity)
{
return (severity.ordinal() >= ordinal());
}
}

View File

@ -0,0 +1,101 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.slf4j.impl;
import java.io.IOException;
import java.util.Properties;
import org.eclipse.jetty.logging.impl.CentralLoggerConfig;
import org.eclipse.jetty.logging.impl.CentralLoggerFactory;
import org.eclipse.jetty.logging.impl.ConsoleAppender;
import org.slf4j.ILoggerFactory;
import org.slf4j.spi.LoggerFactoryBinder;
/**
* Standard entry point for Slf4J, used to configure the desired {@link ILoggerFactory}.
*/
public class StaticLoggerBinder implements LoggerFactoryBinder
{
/**
* Required by {@link org.slf4j.LoggerFactory}
*/
private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
/**
* Required by {@link org.slf4j.LoggerFactory}
*/
public static final StaticLoggerBinder getSingleton()
{
return SINGLETON;
}
/**
* Required by {@link org.slf4j.LoggerFactory}, based on information from slf4j, this field should not be declared
* final (it can cause problems with optimizations occurring within the java compiler)
*/
public static/* final */String REQUESTED_API_VERSION = "1.5.6";
private static final String loggerFactoryClassName = CentralLoggerFactory.class.getName();
private CentralLoggerFactory loggerFactory;
private CentralLoggerConfig root;
public CentralLoggerConfig getRoot()
{
if(root == null) {
try
{
Properties props = new Properties();
props.setProperty("root.level","DEBUG");
props.setProperty("root.appenders","console");
props.setProperty("appender.console.class",ConsoleAppender.class.getName());
root = CentralLoggerConfig.load(props);
}
catch (IOException e)
{
e.printStackTrace(System.err);
}
}
return root;
}
public void setRoot(CentralLoggerConfig root)
{
this.root = root;
if (loggerFactory == null)
{
loggerFactory = new CentralLoggerFactory(root);
}
else
{
loggerFactory.setRoot(root);
}
}
public ILoggerFactory getLoggerFactory()
{
if (loggerFactory == null)
{
loggerFactory = new CentralLoggerFactory(getRoot());
}
return loggerFactory;
}
public String getLoggerFactoryClassStr()
{
return loggerFactoryClassName;
}
}

View File

@ -0,0 +1,42 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.slf4j.impl;
import org.slf4j.helpers.NOPMakerAdapter;
import org.slf4j.spi.MDCAdapter;
/**
* Standard entry point for Slf4J, used to configure the desired {@link MDCAdapter}.
*/
public class StaticMDCBinder
{
public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
private StaticMDCBinder()
{
/* prevent external instantiation */
}
public MDCAdapter getMDCA()
{
return new NOPMakerAdapter();
}
public String getMDCAdapterClassStr()
{
return NOPMakerAdapter.class.getName();
}
}

View File

@ -0,0 +1,44 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.slf4j.impl;
import org.slf4j.IMarkerFactory;
import org.slf4j.MarkerFactory;
import org.slf4j.helpers.BasicMarkerFactory;
import org.slf4j.spi.MarkerFactoryBinder;
/**
* Standard entry point for Slf4J, used to configure the desired {@link IMarkerFactory}.
*/
public class StaticMarkerBinder implements MarkerFactoryBinder
{
/**
* Required by {@link MarkerFactory}
*/
public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();
private final IMarkerFactory markerFactory = new BasicMarkerFactory();
public IMarkerFactory getMarkerFactory()
{
return markerFactory;
}
public String getMarkerFactoryClassStr()
{
return markerFactory.getClass().getName();
}
}

View File

@ -0,0 +1,9 @@
target/
.classpath
.project
.settings
*.swp
*.patch
*.diff
*.log
cobertura.ser

View File

@ -0,0 +1,9 @@
target/
.classpath
.project
.settings
*.swp
*.patch
*.diff
*.log
cobertura.ser

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
// ========================================================================
// Copyright (c) Webtide LLC
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>dummy-webapp-logging-commons</artifactId>
<version>7.0.1-SNAPSHOT</version>
<name>Jetty :: Centralized Logging :: Dummy Webapp for Commons Logging</name>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,9 @@
target/
.classpath
.project
.settings
*.swp
*.patch
*.diff
*.log
cobertura.ser

View File

@ -18,27 +18,29 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-webapps-parent</artifactId>
<version>7.0.1-SNAPSHOT</version>
</parent>
<artifactId>test-webapp-logging-commons</artifactId>
<name>Jetty Tests :: WebApp :: Commons Logging</name>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>dummy-webapp-logging-java</artifactId>
<version>7.0.1-SNAPSHOT</version>
<name>Jetty :: Centralized Logging :: Dummy Webapp for Java Util Logging</name>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -5,13 +5,13 @@
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.tests.webapp;
@ -42,12 +42,11 @@ public class LoggingServlet extends HttpServlet
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
log.log(Level.INFO,"LoggingServlet(log4j) initialized");
log.log(Level.INFO,"LoggingServlet(java) GET requested");
}
}

View File

@ -0,0 +1,9 @@
target/
.classpath
.project
.settings
*.swp
*.patch
*.diff
*.log
cobertura.ser

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
// ========================================================================
// Copyright (c) Webtide LLC
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>dummy-webapp-logging-log4j</artifactId>
<version>7.0.1-SNAPSHOT</version>
<name>Jetty :: Centralized Logging :: Dummy Webapp for Log4J Logging</name>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,9 @@
target/
.classpath
.project
.settings
*.swp
*.patch
*.diff
*.log
cobertura.ser

View File

@ -18,27 +18,34 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-webapps-parent</artifactId>
<version>7.0.1-SNAPSHOT</version>
</parent>
<artifactId>test-webapp-logging-slf4j</artifactId>
<name>Jetty Tests :: WebApp :: Slf4J Logging</name>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>dummy-webapp-logging-slf4j</artifactId>
<version>7.0.1-SNAPSHOT</version>
<name>Jetty :: Centralized Logging :: Dummy Webapp for Slf4J Logging</name>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -19,21 +19,18 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-webapps-parent</artifactId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>7.0.1-SNAPSHOT</version>
</parent>
<artifactId>test-webapp-logging-java</artifactId>
<name>Jetty Tests :: WebApp :: JavaSE Logging</name>
<packaging>war</packaging>
<build>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>centralized-logging-test-artifacts-parent</artifactId>
<name>Jetty :: Centralized Logging :: Dummy Webapps Parent</name>
<packaging>pom</packaging>
<modules>
<module>dummy-webapp-logging-commons</module>
<module>dummy-webapp-logging-log4j</module>
<module>dummy-webapp-logging-java</module>
<module>dummy-webapp-logging-slf4j</module>
</modules>
</project>

View File

@ -0,0 +1,84 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging;
import java.io.IOException;
import junit.framework.TestCase;
import org.eclipse.jetty.logging.impl.CentralLoggerConfig;
import org.eclipse.jetty.logging.impl.Severity;
import org.eclipse.jetty.logging.impl.TestAppender;
import org.eclipse.jetty.logging.impl.TestAppender.LogEvent;
public class CentralizedLoggingTest extends TestCase
{
private XmlConfiguredJetty jetty;
private void assertContainsLogEvents(TestAppender capturedEvents, LogEvent[] expectedLogs)
{
for (LogEvent expectedEvent : expectedLogs)
{
assertTrue("LogEvent not found: " + expectedEvent,capturedEvents.contains(expectedEvent));
}
}
@Override
protected void setUp() throws Exception
{
super.setUp();
jetty = new XmlConfiguredJetty(this);
jetty.addConfiguration("jetty.xml");
jetty.addConfiguration("jetty-centralized-logging.xml");
jetty.load();
jetty.start();
}
@Override
protected void tearDown() throws Exception
{
jetty.stop();
super.tearDown();
}
public void testAllRouting() throws IOException
{
CentralLoggerConfig root = CentralizedWebAppLoggingConfiguration.getLoggerRoot();
TestAppender testAppender = (TestAppender)root.findAppender(TestAppender.class);
assertNotNull("Should have found TestAppender in configuration",testAppender);
SimpleRequest.get(jetty,"/dummy-webapp-logging-log4j/logging");
SimpleRequest.get(jetty,"/dummy-webapp-logging-slf4j/logging");
SimpleRequest.get(jetty,"/dummy-webapp-logging-commons/logging");
SimpleRequest.get(jetty,"/dummy-webapp-logging-java/logging");
TestAppender.LogEvent expectedLogs[] =
{ new LogEvent(null,-1,Severity.DEBUG,"LoggingServlet","LoggingServlet(log4j) initialized",null),
new LogEvent(null,-1,Severity.INFO,"LoggingServlet","LoggingServlet(log4j) GET requested",null),
new LogEvent(null,-1,Severity.DEBUG,"LoggingServlet","LoggingServlet(slf4j) initialized",null),
new LogEvent(null,-1,Severity.INFO,"LoggingServlet","LoggingServlet(slf4j) GET requested",null),
new LogEvent(null,-1,Severity.DEBUG,"LoggingServlet","LoggingServlet(commons-logging) initialized",null),
new LogEvent(null,-1,Severity.INFO,"LoggingServlet","LoggingServlet(commons-logging) GET requested",null),
new LogEvent(null,-1,Severity.DEBUG,"LoggingServlet","LoggingServlet(java) initialized",null),
new LogEvent(null,-1,Severity.INFO,"LoggingServlet","LoggingServlet(java) GET requested",null) };
assertContainsLogEvents(testAppender,expectedLogs);
}
}

View File

@ -0,0 +1,159 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
import org.eclipse.jetty.logging.impl.CentralLoggerConfig;
import org.eclipse.jetty.logging.impl.Severity;
import org.eclipse.jetty.logging.impl.TestAppender;
import org.eclipse.jetty.logging.impl.TestAppender.LogEvent;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
/**
* Test centralized logging in an embedded scenario
*/
public class EmbeddedCentralizedLoggingTest extends TestCase
{
private TestAppender testAppender;
private void assertContainsLogEvents(TestAppender capturedEvents, LogEvent[] expectedLogs)
{
for (LogEvent expectedEvent : expectedLogs)
{
assertTrue("LogEvent not found: " + expectedEvent,capturedEvents.contains(expectedEvent));
}
}
protected Server createWebAppServer(String contextPath, String webappName) throws Exception
{
if (!CentralizedWebAppLoggingConfiguration.isLoggerConfigured())
{
String loggerConfigFilename = MavenTestingUtils.getTestResourceFile("logger/testing.properties").getAbsolutePath();
CentralizedWebAppLoggingConfiguration.setLoggerConfigurationFilename(loggerConfigFilename);
}
CentralLoggerConfig root = CentralizedWebAppLoggingConfiguration.getLoggerRoot();
testAppender = (TestAppender)root.findAppender(TestAppender.class);
testAppender.reset();
Server server = new Server();
List<Configuration> serverConfigs = new ArrayList<Configuration>();
serverConfigs.add(new CentralizedWebAppLoggingConfiguration());
server.setAttribute(WebAppContext.SERVER_CONFIG,serverConfigs);
Connector connector = new SelectChannelConnector();
connector.setPort(0);
server.setConnectors(new Connector[]
{ connector });
File webappFile = MavenTestingUtils.getTestResourceFile("webapps/" + webappName);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath(contextPath);
webapp.setWar(webappFile.getAbsolutePath());
server.setHandler(webapp);
return server;
}
@Override
protected void setUp() throws Exception
{
super.setUp();
File testTmpDir = new File(MavenTestingUtils.getTargetTestingDir(this),"workdir");
testTmpDir.mkdirs();
System.setProperty("java.io.tmpdir",testTmpDir.getAbsolutePath());
}
public void testEmbeddedWebappLog4j() throws Exception
{
Server server = createWebAppServer("/log4j","dummy-webapp-logging-log4j.war");
server.start();
SimpleRequest.get(server,"/log4j/logging");
server.stop();
TestAppender.LogEvent expectedLogs[] =
{ new LogEvent(null,-1,Severity.DEBUG,"LoggingServlet","LoggingServlet(log4j) initialized",null),
new LogEvent(null,-1,Severity.INFO,"LoggingServlet","LoggingServlet(log4j) GET requested",null) };
assertContainsLogEvents(testAppender,expectedLogs);
}
public void testEmbeddedWebappSlf4j() throws Exception
{
Server server = createWebAppServer("/slf4j","dummy-webapp-logging-slf4j.war");
server.start();
SimpleRequest.get(server,"/slf4j/logging");
server.stop();
TestAppender.LogEvent expectedLogs[] =
{ new LogEvent(null,-1,Severity.DEBUG,"LoggingServlet","LoggingServlet(slf4j) initialized",null),
new LogEvent(null,-1,Severity.INFO,"LoggingServlet","LoggingServlet(slf4j) GET requested",null) };
assertContainsLogEvents(testAppender,expectedLogs);
}
public void testEmbeddedWebappCommonsLogging() throws Exception
{
Server server = createWebAppServer("/clogging","dummy-webapp-logging-commons.war");
server.start();
SimpleRequest.get(server,"/clogging/logging");
server.stop();
TestAppender.LogEvent expectedLogs[] =
{ new LogEvent(null,-1,Severity.DEBUG,"LoggingServlet","LoggingServlet(commons-logging) initialized",null),
new LogEvent(null,-1,Severity.INFO,"LoggingServlet","LoggingServlet(commons-logging) GET requested",null) };
assertContainsLogEvents(testAppender,expectedLogs);
}
public void testEmbeddedWebappJavaUtil() throws Exception
{
Server server = createWebAppServer("/javalogging","dummy-webapp-logging-java.war");
server.start();
SimpleRequest.get(server,"/javalogging/logging");
server.stop();
TestAppender.LogEvent expectedLogs[] =
{ new LogEvent(null,-1,Severity.DEBUG,"LoggingServlet","LoggingServlet(java) initialized",null),
new LogEvent(null,-1,Severity.INFO,"LoggingServlet","LoggingServlet(java) GET requested",null) };
assertContainsLogEvents(testAppender,expectedLogs);
}
}

View File

@ -0,0 +1,178 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import junit.framework.TestCase;
import org.eclipse.jetty.util.IO;
/**
* Common utility methods for working with JUnit tests cases in a maven friendly way.
*/
public class MavenTestingUtils
{
private static File basedir;
private static File testResourcesDir;
private static File targetDir;
public static File getBasedir()
{
if (basedir == null)
{
String cwd = System.getProperty("basedir");
if (cwd == null)
{
cwd = System.getProperty("user.dir");
}
basedir = new File(cwd);
}
return basedir;
}
/**
* Get the directory to the /target directory for this project.
*
* @return the directory path to the target directory.
*/
public static File getTargetDir()
{
if (targetDir == null)
{
targetDir = new File(basedir,"target");
PathAssert.assertDirExists("Target Dir",targetDir);
}
return targetDir;
}
/**
* Create a {@link File} object for a path in the /target directory.
*
* @param path
* the path desired, no validation of existence is performed.
* @return the File to the path.
*/
public static File getTargetFile(String path)
{
return new File(getTargetDir(),path.replace("/",File.separator));
}
public static File getTargetTestingDir()
{
File dir = new File(getTargetDir(),"testing");
if (!dir.exists())
{
dir.mkdirs();
}
return dir;
}
public static File getTargetTestingDir(TestCase test)
{
File dir = new File(getTargetDir(),"test-" + test.getName());
if (!dir.exists())
{
dir.mkdirs();
}
return dir;
}
/**
* Get a dir from the src/test/resource directory.
*
* @param name
* the name of the path to get (it must exist as a dir)
* @return the dir in src/test/resource
*/
public static File getTestResourceDir(String name)
{
File dir = new File(getTestResourcesDir(),name);
PathAssert.assertDirExists("Test Resource Dir",dir);
return dir;
}
/**
* Get a file from the src/test/resource directory.
*
* @param name
* the name of the path to get (it must exist as a file)
* @return the file in src/test/resource
*/
public static File getTestResourceFile(String name)
{
File file = new File(getTestResourcesDir(),name);
PathAssert.assertFileExists("Test Resource File",file);
return file;
}
/**
* Get a path resource (File or Dir) from the src/test/resource directory.
*
* @param name
* the name of the path to get (it must exist)
* @return the path in src/test/resource
*/
public static File getTestResourcePath(String name)
{
File path = new File(getTestResourcesDir(),name);
PathAssert.assertExists("Test Resource Path",path);
return path;
}
/**
* Get the directory to the src/test/resource directory
*
* @return the directory {@link File} to the src/test/resources directory
*/
public static File getTestResourcesDir()
{
if (testResourcesDir == null)
{
testResourcesDir = new File(basedir,"src/test/resources".replace("/",File.separator));
PathAssert.assertDirExists("Test Resources Dir",testResourcesDir);
}
return testResourcesDir;
}
/**
* Read the contents of a file into a String and return it.
*
* @param file
* the file to read.
* @return the contents of the file.
* @throws IOException
* if unable to read the file.
*/
public static String readToString(File file) throws IOException
{
FileReader reader = null;
try
{
reader = new FileReader(file);
return IO.toString(reader);
}
finally
{
IO.close(reader);
}
}
}

View File

@ -0,0 +1,40 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging;
import java.io.File;
import junit.framework.Assert;
public class PathAssert
{
public static void assertDirExists(String msg, File path)
{
assertExists(msg,path);
Assert.assertTrue(msg + " path should be a Dir : " + path.getAbsolutePath(),path.isDirectory());
}
public static void assertFileExists(String msg, File path)
{
assertExists(msg,path);
Assert.assertTrue(msg + " path should be a File : " + path.getAbsolutePath(),path.isFile());
}
public static void assertExists(String msg, File path)
{
Assert.assertTrue(msg + " path should exist: " + path.getAbsolutePath(),path.exists());
}
}

View File

@ -0,0 +1,114 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.URI;
import junit.framework.Assert;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.IO;
/**
* Utility class for performing simple requests.
*/
public class SimpleRequest
{
/**
* Issue an HTTP GET to the server, on the path specified.
*
* @param jetty
* @param path
* @throws IOException
*/
public static String get(XmlConfiguredJetty jetty, String path) throws IOException
{
URI fullUri = jetty.getServerURI().resolve(path);
return get(fullUri);
}
/**
* Issue an HTTP GET to the server, on the path specified.
*
* @param jetty
* @param path
* @throws IOException
*/
public static String get(Server server, String path) throws IOException
{
// Find the active server port.
int serverPort = (-1);
Connector connectors[] = server.getConnectors();
for (int i = 0; i < connectors.length; i++)
{
Connector connector = connectors[i];
if (connector.getLocalPort() > 0)
{
serverPort = connector.getLocalPort();
break;
}
}
StringBuffer uri = new StringBuffer();
uri.append("http://");
uri.append(InetAddress.getLocalHost().getHostAddress());
uri.append(":").append(serverPort);
URI fullUri = URI.create(uri.toString()).resolve(path);
return get(fullUri);
}
private static String get(URI fullUri) throws IOException
{
System.out.println("GET: " + fullUri.toASCIIString());
HttpURLConnection conn = (HttpURLConnection)fullUri.toURL().openConnection();
conn.setRequestMethod("GET");
conn.setUseCaches(false);
conn.setAllowUserInteraction(false);
conn.connect();
Assert.assertEquals(fullUri.toASCIIString() + " Response Code (200 OK)",200,conn.getResponseCode());
InputStream in = null;
InputStreamReader reader = null;
try
{
in = conn.getInputStream();
reader = new InputStreamReader(in);
String response = IO.toString(reader);
if (conn.getResponseCode() != 200)
{
System.out.println(response);
}
return response;
}
finally
{
IO.close(reader);
IO.close(in);
}
}
}

View File

@ -0,0 +1,206 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.eclipse.jetty.http.HttpSchemes;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.xml.XmlConfiguration;
/**
* Allows for setting up a Jetty server for testing based on XML configuration files.
*/
public class XmlConfiguredJetty
{
private List<URL> xmlConfigurations;
private Properties properties = new Properties();
private Server server;
private int serverPort;
private String scheme = HttpSchemes.HTTP;
public XmlConfiguredJetty(TestCase test) throws IOException
{
xmlConfigurations = new ArrayList<URL>();
properties = new Properties();
File jettyHome = MavenTestingUtils.getTargetTestingDir(test);
// Prepare Jetty.Home (Test) dir
jettyHome.mkdirs();
File logsDir = new File(jettyHome,"logs");
logsDir.mkdirs();
File etcDir = new File(jettyHome,"etc");
etcDir.mkdirs();
IO.copyFile(MavenTestingUtils.getTestResourceFile("etc/realm.properties"),new File(etcDir,"realm.properties"));
File webappsDir = new File(jettyHome,"webapps");
webappsDir.mkdirs();
File tmpDir = new File(MavenTestingUtils.getTargetTestingDir(test),"tmp");
tmpDir.mkdirs();
// Setup properties
System.setProperty("java.io.tmpdir",tmpDir.getAbsolutePath());
properties.setProperty("jetty.home",jettyHome.getAbsolutePath());
System.setProperty("jetty.home",jettyHome.getAbsolutePath());
properties.setProperty("test.basedir",MavenTestingUtils.getBasedir().getAbsolutePath());
properties.setProperty("test.resourcesdir",MavenTestingUtils.getTestResourcesDir().getAbsolutePath());
properties.setProperty("test.webapps",MavenTestingUtils.getTestResourceDir("webapps").getAbsolutePath());
properties.setProperty("test.targetdir",MavenTestingUtils.getTargetDir().getAbsolutePath());
// Write out configuration for use by ConfigurationManager.
File testConfig = MavenTestingUtils.getTargetFile("xml-configured-jetty.properties");
FileOutputStream out = new FileOutputStream(testConfig);
properties.store(out,"Generated by " + XmlConfiguredJetty.class.getName());
}
public void addConfiguration(URL xmlConfig)
{
xmlConfigurations.add(xmlConfig);
}
public void addConfiguration(File xmlConfigFile) throws MalformedURLException
{
xmlConfigurations.add(xmlConfigFile.toURL());
}
public void addConfiguration(String testConfigName) throws MalformedURLException
{
addConfiguration(MavenTestingUtils.getTestResourceFile(testConfigName));
}
public void setProperty(String key, String value)
{
properties.setProperty(key,value);
}
@SuppressWarnings("unchecked")
public void load() throws Exception
{
XmlConfiguration last = null;
Object[] obj = new Object[this.xmlConfigurations.size()];
// Configure everything
for (int i = 0; i < this.xmlConfigurations.size(); i++)
{
URL configURL = this.xmlConfigurations.get(i);
XmlConfiguration configuration = new XmlConfiguration(configURL);
if (last != null)
{
configuration.getIdMap().putAll(last.getIdMap());
}
configuration.setProperties(properties);
obj[i] = configuration.configure();
last = configuration;
}
// Test for Server Instance.
Server foundServer = null;
int serverCount = 0;
for (int i = 0; i < this.xmlConfigurations.size(); i++)
{
if (obj[i] instanceof Server)
{
if (obj[i].equals(foundServer))
{
// Identical server instance found
break;
}
foundServer = (Server)obj[i];
serverCount++;
}
}
if (serverCount <= 0)
{
throw new Exception("Load failed to configure a " + Server.class.getName());
}
Assert.assertEquals("Server load count",1,serverCount);
this.server = foundServer;
this.server.setGracefulShutdown(10);
}
public String getScheme()
{
return scheme;
}
public void setScheme(String scheme)
{
this.scheme = scheme;
}
public void start() throws Exception
{
Assert.assertNotNull("Server should not be null (failed load?)",server);
server.start();
// Find the active server port.
this.serverPort = (-1);
Connector connectors[] = server.getConnectors();
for (int i = 0; i < connectors.length; i++)
{
Connector connector = connectors[i];
if (connector.getLocalPort() > 0)
{
this.serverPort = connector.getLocalPort();
break;
}
}
Assert.assertTrue("Server Port is between 1 and 65535. Actually <" + serverPort + ">",(1 <= this.serverPort) && (this.serverPort <= 65535));
}
public int getServerPort()
{
return serverPort;
}
public void stop() throws Exception
{
server.stop();
}
public URI getServerURI() throws UnknownHostException
{
StringBuffer uri = new StringBuffer();
uri.append(this.scheme).append("://");
uri.append(InetAddress.getLocalHost().getHostAddress());
uri.append(":").append(this.serverPort);
return URI.create(uri.toString());
}
}

View File

@ -0,0 +1,184 @@
package org.eclipse.jetty.logging.impl;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import junit.framework.TestCase;
import org.eclipse.jetty.logging.MavenTestingUtils;
import org.slf4j.Logger;
public class ConfiguredLoggerTest extends TestCase
{
private void assertAppenders(CentralLoggerConfig logger, Class<?>... clazzes)
{
assertNotNull("Appenders should not be null",logger.getAppenders());
assertTrue("Should have appenders",logger.getAppenders().size() >= 1);
List<String> expectedAppenders = new ArrayList<String>();
List<String> actualAppenders = new ArrayList<String>();
for (Class<?> clazz : clazzes)
{
expectedAppenders.add(clazz.getName());
}
for (Appender appender : logger.getAppenders())
{
actualAppenders.add(appender.getClass().getName());
}
// Sort
Collections.sort(expectedAppenders);
Collections.sort(actualAppenders);
// Same Size?
if (expectedAppenders.size() != actualAppenders.size())
{
System.out.println("/* Actual */");
for (String name : actualAppenders)
{
System.out.println(name);
}
System.out.println("/* Expected */");
for (String name : expectedAppenders)
{
System.out.println(name);
}
assertEquals("Appender count",expectedAppenders.size(),actualAppenders.size());
}
// Same Content?
for (int i = 0, n = expectedAppenders.size(); i < n; i++)
{
assertEquals("Appender[" + i + "]",expectedAppenders.get(i),actualAppenders.get(i));
}
}
private void assertSeverityLevel(CentralLoggerConfig logger, Severity severity)
{
assertEquals("Severity",severity,logger.getLevel());
}
public void testRootDebug() throws Exception
{
Properties props = new Properties();
props.setProperty("root.level","DEBUG");
CentralLoggerConfig root = CentralLoggerConfig.load(props);
assertNotNull("Root Logger should not be null",root);
assertSeverityLevel(root,Severity.DEBUG);
assertAppenders(root,ConsoleAppender.class);
}
public void testRootTrace() throws Exception
{
Properties props = new Properties();
props.setProperty("root.level","TRACE");
CentralLoggerConfig root = CentralLoggerConfig.load(props);
assertNotNull("Root Logger should not be null",root);
assertSeverityLevel(root,Severity.TRACE);
assertAppenders(root,ConsoleAppender.class);
}
public void testRootWarn() throws Exception
{
Properties props = new Properties();
props.setProperty("root.level","WARN");
CentralLoggerConfig root = CentralLoggerConfig.load(props);
assertNotNull("Root Logger should not be null",root);
assertSeverityLevel(root,Severity.WARN);
assertAppenders(root,ConsoleAppender.class);
}
public void testSimpleConfig() throws Exception
{
Properties props = new Properties();
props.setProperty("root.level","DEBUG");
CentralLoggerConfig root = CentralLoggerConfig.load(props);
assertNotNull("Root Logger should not be null",root);
assertSeverityLevel(root,Severity.DEBUG);
assertAppenders(root,ConsoleAppender.class);
}
public void testCapturedAppender() throws Exception
{
Properties props = new Properties();
props.setProperty("root.level","DEBUG");
props.setProperty("root.appenders","test");
props.setProperty("appender.test.class",TestAppender.class.getName());
CentralLoggerConfig root = CentralLoggerConfig.load(props);
assertNotNull("Root Logger should not be null",root);
assertSeverityLevel(root,Severity.DEBUG);
assertAppenders(root,TestAppender.class);
}
public void testRollingFileAppender() throws Exception
{
Properties props = new Properties();
File testLoggingDir = new File(MavenTestingUtils.getTargetTestingDir(this),"logs");
testLoggingDir.mkdirs();
File logFile = new File(testLoggingDir,"rolling.log");
props.setProperty("root.level","DEBUG");
props.setProperty("root.appenders","roll");
props.setProperty("appender.roll.class",RollingFileAppender.class.getName());
props.setProperty("appender.roll.filename",logFile.getAbsolutePath());
props.setProperty("appender.roll.append","true");
props.setProperty("appender.roll.retainDays","120");
props.setProperty("appender.roll.zone","GMT");
props.setProperty("appender.roll.dateFormat","yyyy-MM-dd");
props.setProperty("appender.roll.backupFormat","HH-mm-ss.SSS");
CentralLoggerConfig root = CentralLoggerConfig.load(props);
assertNotNull("Root Logger should not be null",root);
assertSeverityLevel(root,Severity.DEBUG);
assertAppenders(root,RollingFileAppender.class);
RollingFileAppender actualAppender = (RollingFileAppender)root.getAppenders().get(0);
assertEquals("RollingFileAppender.filename",logFile.getAbsolutePath(),actualAppender.getFilename());
assertEquals("RollingFileAppender.append",true,actualAppender.isAppend());
assertEquals("RollingFileAppender.retainDays",120,actualAppender.getRetainDays());
assertEquals("RollingFileAppender.zone","GMT",actualAppender.getZone().getID());
assertEquals("RollingFileAppender.dateFormat","yyyy-MM-dd",actualAppender.getDateFormat());
assertEquals("RollingFileAppender.backupFormat","HH-mm-ss.SSS",actualAppender.getBackupFormat());
}
public void testGetConfiguredLogger() throws IOException
{
Properties props = new Properties();
props.setProperty("root.level","DEBUG");
props.setProperty("root.appenders","console");
props.setProperty("logger.org.eclipse.jetty.logging.level","WARN");
props.setProperty("logger.org.eclipse.jetty.logging.appenders","test");
props.setProperty("appender.test.class",TestAppender.class.getName());
props.setProperty("appender.console.class",ConsoleAppender.class.getName());
CentralLoggerConfig root = CentralLoggerConfig.load(props);
assertNotNull("Root Logger should not be null",root);
assertEquals("Root Logger.name",Logger.ROOT_LOGGER_NAME,root.getName());
assertSeverityLevel(root,Severity.DEBUG);
assertAppenders(root,ConsoleAppender.class);
CentralLoggerConfig jettyLogger = root.getConfiguredLogger("org.eclipse.jetty");
assertNotNull("Jetty Logger should not be null",jettyLogger);
assertEquals("Jetty Logger.name","org.eclipse.jetty",jettyLogger.getName());
assertSeverityLevel(jettyLogger,Severity.DEBUG);
assertAppenders(jettyLogger,ConsoleAppender.class);
CentralLoggerConfig implLogger = root.getConfiguredLogger("org.eclipse.jetty.logging.impl");
assertNotNull("Jetty Logging Impl Logger should not be null",implLogger);
assertEquals("Jetty Logging Impl Logger.name","org.eclipse.jetty.logging.impl",implLogger.getName());
assertSeverityLevel(implLogger,Severity.WARN);
assertAppenders(implLogger,ConsoleAppender.class,TestAppender.class);
}
}

View File

@ -0,0 +1,28 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging.impl;
import junit.framework.TestCase;
public class SeverityTest extends TestCase
{
public void testIsEnabled()
{
assertTrue("DEBUG.isEnabled(INFO)",Severity.DEBUG.isEnabled(Severity.INFO));
assertTrue("DEBUG.isEnabled(DEBUG)",Severity.DEBUG.isEnabled(Severity.DEBUG));
assertFalse("DEBUG.isEnabled(TRACE)",Severity.DEBUG.isEnabled(Severity.TRACE));
}
}

View File

@ -0,0 +1,115 @@
// ========================================================================
// Copyright (c) Webtide LLC
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.logging.impl;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* Test Appender, records the logging events.
*/
public class TestAppender implements Appender
{
public static class LogEvent
{
String date;
int ms;
Severity severity;
String name;
String message;
Throwable t;
public LogEvent(String date, int ms, Severity severity, String name, String message, Throwable t)
{
super();
this.date = date;
this.ms = ms;
this.severity = severity;
this.name = name;
this.message = message;
this.t = t;
}
@Override
public String toString()
{
StringBuffer buf = new StringBuffer();
buf.append(severity.name()).append("|");
buf.append(name).append("|");
buf.append(message);
return buf.toString();
}
}
private List<LogEvent> events = new ArrayList<LogEvent>();
public void append(String date, int ms, Severity severity, String name, String message, Throwable t)
{
if (name.equals("log")) // standard jetty logger
{
return; // skip storing it.
}
events.add(new LogEvent(date,ms,severity,name,message,t));
}
public void close() throws IOException
{
/* nothing to do here */
}
public boolean contains(LogEvent expectedEvent)
{
// System.out.println("Looking for: " + expectedEvent);
for (LogEvent event : events)
{
// System.out.println("Event: " + event);
if (!event.name.equals(expectedEvent.name))
{
continue; // not a match. skip.
}
if (!event.severity.equals(expectedEvent.severity))
{
continue; // not a match. skip.
}
if (event.message.equals(expectedEvent.message))
{
return true;
}
}
return false;
}
public List<LogEvent> getEvents()
{
return events;
}
public void open() throws IOException
{
/* nothing to do here */
}
public void reset()
{
events.clear();
}
public void setProperty(String key, String value) throws Exception
{
/* nothing to do here */
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/commons</Set>
<Set name="war">
<Property name="test.webapps" default="." />/dummy-webapp-logging-commons.war
</Set>
</Configure>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/java</Set>
<Set name="war">
<Property name="test.webapps" default="." />/dummy-webapp-logging-java.war
</Set>
</Configure>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/log4j</Set>
<Set name="war">
<Property name="test.webapps" default="." />/dummy-webapp-logging-log4j.war
</Set>
</Configure>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/slf4j</Set>
<Set name="war">
<Property name="test.webapps" default="." />/dummy-webapp-logging-slf4j.war
</Set>
</Configure>

View File

@ -0,0 +1,21 @@
#
# This file defines users passwords and roles for a HashUserRealm
#
# The format is
# <username>: <password>[,<rolename> ...]
#
# Passwords may be clear text, obfuscated or checksummed. The class
# org.eclipse.util.Password should be used to generate obfuscated
# passwords or password checksums
#
# If DIGEST Authentication is used, the password must be in a recoverable
# format, either plain text or OBF:.
#
jetty: MD5:164c88b302622e17050af52c89945d44,user
admin: CRYPT:adpexzg3FUZAk,server-administrator,content-administrator,admin
other: OBF:1xmk1w261u9r1w1c1xmq,user
plain: plain,user
user: password,user
# This entry is for digest auth. The credential is a MD5 hash of username:realmname:password
digest: MD5:6e120743ad67abfbc385bc2bb754e297,user

View File

@ -0,0 +1,404 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- ===================================================================== -->
<!-- This file contains the default descriptor for web applications. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- The intent of this descriptor is to include jetty specific or common -->
<!-- configuration for all webapps. If a context has a webdefault.xml -->
<!-- descriptor, it is applied before the contexts own web.xml file -->
<!-- -->
<!-- A context may be assigned a default descriptor by: -->
<!-- + Calling WebApplicationContext.setDefaultsDescriptor -->
<!-- + Passed an arg to addWebApplications -->
<!-- -->
<!-- This file is used both as the resource within the jetty.jar (which is -->
<!-- used as the default if no explicit defaults descriptor is set) and it -->
<!-- is copied to the etc directory of the Jetty distro and explicitly -->
<!-- by the jetty.xml file. -->
<!-- -->
<!-- ===================================================================== -->
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="true"
version="2.5">
<description>
Default web.xml file.
This file is applied to a Web application before it's own WEB_INF/web.xml file
</description>
<!-- ==================================================================== -->
<!-- Context params to control Session Cookies -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- UNCOMMENT TO ACTIVATE
<context-param>
<param-name>org.eclipse.jetty.servlet.SessionDomain</param-name>
<param-value>127.0.0.1</param-value>
</context-param>
<context-param>
<param-name>org.eclipse.jetty.servlet.SessionPath</param-name>
<param-value>/</param-value>
</context-param>
<context-param>
<param-name>org.eclipse.jetty.servlet.MaxAge</param-name>
<param-value>-1</param-value>
</context-param>
-->
<!-- ==================================================================== -->
<!-- The default servlet. -->
<!-- This servlet, normally mapped to /, provides the handling for static -->
<!-- content, OPTIONS and TRACE methods for the context. -->
<!-- The following initParameters are supported: -->
<!-- -->
<!-- acceptRanges If true, range requests and responses are -->
<!-- supported -->
<!-- -->
<!-- dirAllowed If true, directory listings are returned if no -->
<!-- welcome file is found. Else 403 Forbidden. -->
<!-- -->
<!-- welcomeServlets If true, attempt to dispatch to welcome files -->
<!-- that are servlets, if no matching static -->
<!-- resources can be found. -->
<!-- -->
<!-- redirectWelcome If true, redirect welcome file requests -->
<!-- else use request dispatcher forwards -->
<!-- -->
<!-- gzip If set to true, then static content will be served-->
<!-- as gzip content encoded if a matching resource is -->
<!-- found ending with ".gz" -->
<!-- -->
<!-- resoureBase Can be set to replace the context resource base -->
<!-- -->
<!-- relativeResourceBase -->
<!-- Set with a pathname relative to the base of the -->
<!-- servlet context root. Useful for only serving -->
<!-- static content from only specific subdirectories. -->
<!-- -->
<!-- useFileMappedBuffer -->
<!-- If set to true (the default), a memory mapped -->
<!-- file buffer will be used to serve static content -->
<!-- when using an NIO connector. Setting this value -->
<!-- to false means that a direct buffer will be used -->
<!-- instead. If you are having trouble with Windows -->
<!-- file locking, set this to false. -->
<!-- -->
<!-- cacheControl If set, all static content will have this value -->
<!-- set as the cache-control header. -->
<!-- -->
<!-- maxCacheSize Maximum size of the static resource cache -->
<!-- -->
<!-- maxCachedFileSize Maximum size of any single file in the cache -->
<!-- -->
<!-- maxCachedFiles Maximum number of files in the cache -->
<!-- -->
<!-- cacheType "nio", "bio" or "both" to determine the type(s) -->
<!-- of resource cache. A bio cached buffer may be used-->
<!-- by nio but is not as efficient as a nio buffer. -->
<!-- An nio cached buffer may not be used by bio. -->
<!-- -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>acceptRanges</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>welcomeServlets</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>redirectWelcome</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>maxCacheSize</param-name>
<param-value>256000000</param-value>
</init-param>
<init-param>
<param-name>maxCachedFileSize</param-name>
<param-value>10000000</param-value>
</init-param>
<init-param>
<param-name>maxCachedFiles</param-name>
<param-value>1000</param-value>
</init-param>
<init-param>
<param-name>cacheType</param-name>
<param-value>both</param-value>
</init-param>
<init-param>
<param-name>gzip</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>useFileMappedBuffer</param-name>
<param-value>true</param-value>
</init-param>
<!--
<init-param>
<param-name>cacheControl</param-name>
<param-value>max-age=3600,public</param-value>
</init-param>
-->
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
<!-- ==================================================================== -->
<!-- JSP Servlet -->
<!-- This is the jasper JSP servlet from the jakarta project -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- The JSP page compiler and execution servlet, which is the mechanism -->
<!-- used by Glassfish to support JSP pages. Traditionally, this servlet -->
<!-- is mapped to URL patterh "*.jsp". This servlet supports the -->
<!-- following initialization parameters (default values are in square -->
<!-- brackets): -->
<!-- -->
<!-- checkInterval If development is false and reloading is true, -->
<!-- background compiles are enabled. checkInterval -->
<!-- is the time in seconds between checks to see -->
<!-- if a JSP page needs to be recompiled. [300] -->
<!-- -->
<!-- compiler Which compiler Ant should use to compile JSP -->
<!-- pages. See the Ant documenation for more -->
<!-- information. [javac] -->
<!-- -->
<!-- classdebuginfo Should the class file be compiled with -->
<!-- debugging information? [true] -->
<!-- -->
<!-- classpath What class path should I use while compiling -->
<!-- generated servlets? [Created dynamically -->
<!-- based on the current web application] -->
<!-- Set to ? to make the container explicitly set -->
<!-- this parameter. -->
<!-- -->
<!-- development Is Jasper used in development mode (will check -->
<!-- for JSP modification on every access)? [true] -->
<!-- -->
<!-- enablePooling Determines whether tag handler pooling is -->
<!-- enabled [true] -->
<!-- -->
<!-- fork Tell Ant to fork compiles of JSP pages so that -->
<!-- a separate JVM is used for JSP page compiles -->
<!-- from the one Tomcat is running in. [true] -->
<!-- -->
<!-- ieClassId The class-id value to be sent to Internet -->
<!-- Explorer when using <jsp:plugin> tags. -->
<!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
<!-- -->
<!-- javaEncoding Java file encoding to use for generating java -->
<!-- source files. [UTF-8] -->
<!-- -->
<!-- keepgenerated Should we keep the generated Java source code -->
<!-- for each page instead of deleting it? [true] -->
<!-- -->
<!-- logVerbosityLevel The level of detailed messages to be produced -->
<!-- by this servlet. Increasing levels cause the -->
<!-- generation of more messages. Valid values are -->
<!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. -->
<!-- [WARNING] -->
<!-- -->
<!-- mappedfile Should we generate static content with one -->
<!-- print statement per input line, to ease -->
<!-- debugging? [false] -->
<!-- -->
<!-- -->
<!-- reloading Should Jasper check for modified JSPs? [true] -->
<!-- -->
<!-- suppressSmap Should the generation of SMAP info for JSR45 -->
<!-- debugging be suppressed? [false] -->
<!-- -->
<!-- dumpSmap Should the SMAP info for JSR45 debugging be -->
<!-- dumped to a file? [false] -->
<!-- False if suppressSmap is true -->
<!-- -->
<!-- scratchdir What scratch directory should we use when -->
<!-- compiling JSP pages? [default work directory -->
<!-- for the current web application] -->
<!-- -->
<!-- tagpoolMaxSize The maximum tag handler pool size [5] -->
<!-- -->
<!-- xpoweredBy Determines whether X-Powered-By response -->
<!-- header is added by generated servlet [false] -->
<!-- -->
<!-- If you wish to use Jikes to compile JSP pages: -->
<!-- Set the init parameter "compiler" to "jikes". Define -->
<!-- the property "-Dbuild.compiler.emacs=true" when starting Jetty -->
<!-- to cause Jikes to emit error messages in a format compatible with -->
<!-- Jasper. -->
<!-- If you get an error reporting that jikes can't use UTF-8 encoding, -->
<!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet id="jsp">
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>DEBUG</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<!--
<init-param>
<param-name>classpath</param-name>
<param-value>?</param-value>
</init-param>
-->
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspf</url-pattern>
<url-pattern>*.jspx</url-pattern>
<url-pattern>*.xsp</url-pattern>
<url-pattern>*.JSP</url-pattern>
<url-pattern>*.JSPF</url-pattern>
<url-pattern>*.JSPX</url-pattern>
<url-pattern>*.XSP</url-pattern>
</servlet-mapping>
<!-- ==================================================================== -->
<!-- Dynamic Servlet Invoker. -->
<!-- This servlet invokes anonymous servlets that have not been defined -->
<!-- in the web.xml or by other means. The first element of the pathInfo -->
<!-- of a request passed to the envoker is treated as a servlet name for -->
<!-- an existing servlet, or as a class name of a new servlet. -->
<!-- This servlet is normally mapped to /servlet/* -->
<!-- This servlet support the following initParams: -->
<!-- -->
<!-- nonContextServlets If false, the invoker can only load -->
<!-- servlets from the contexts classloader. -->
<!-- This is false by default and setting this -->
<!-- to true may have security implications. -->
<!-- -->
<!-- verbose If true, log dynamic loads -->
<!-- -->
<!-- * All other parameters are copied to the -->
<!-- each dynamic servlet as init parameters -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Uncomment for dynamic invocation
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.Invoker</servlet-class>
<init-param>
<param-name>verbose</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>nonContextServlets</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>dynamicParam</param-name>
<param-value>anyValue</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping>
-->
<!-- ==================================================================== -->
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<!-- ==================================================================== -->
<!-- Default MIME mappings -->
<!-- The default MIME mappings are provided by the mime.properties -->
<!-- resource in the org.eclipse.jetty.server.jar file. Additional or modified -->
<!-- mappings may be specified here -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- UNCOMMENT TO ACTIVATE
<mime-mapping>
<extension>mysuffix</extension>
<mime-type>mymime/type</mime-type>
</mime-mapping>
-->
<!-- ==================================================================== -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- ==================================================================== -->
<locale-encoding-mapping-list>
<locale-encoding-mapping><locale>ar</locale><encoding>ISO-8859-6</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>be</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>bg</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ca</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>cs</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>da</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>de</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>el</locale><encoding>ISO-8859-7</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>en</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>es</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>et</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>fi</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>fr</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>hr</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>hu</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>is</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>it</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>iw</locale><encoding>ISO-8859-8</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ja</locale><encoding>Shift_JIS</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ko</locale><encoding>EUC-KR</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>lt</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>lv</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>mk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>nl</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>no</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>pl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>pt</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ro</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ru</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sh</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sk</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sq</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sr</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sv</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>tr</locale><encoding>ISO-8859-9</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>uk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>zh</locale><encoding>GB2312</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>zh_TW</locale><encoding>Big5</encoding></locale-encoding-mapping>
</locale-encoding-mapping-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>Disable TRACE</web-resource-name>
<url-pattern>/</url-pattern>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
</web-app>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Enable Centralized Logging in the Jetty Server -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.logging.CentralizedLogging">
<Set name="server"><Ref id="Server" /></Set>
<Set name="configurationFilename"><SystemProperty name="test.resourcesdir" default="src/test/resources"/>/logger/testing.properties</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,219 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure the Jetty Server -->
<!-- -->
<!-- Documentation of this file format can be found at: -->
<!-- http://docs.codehaus.org/display/JETTY/jetty.xml -->
<!-- -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default queued blocking threadpool
-->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">200</Set>
</New>
<!-- Optional Java 5 bounded threadpool with job queue
<New class="org.eclipse.thread.concurrent.ThreadPool">
<Set name="corePoolSize">50</Set>
<Set name="maximumPoolSize">50</Set>
</New>
-->
</Set>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"></Set>
<Set name="port">0</Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To add a HTTPS SSL connector -->
<!-- mixin jetty-ssl.xml: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To add a HTTP blocking connector -->
<!-- mixin jetty-bio.xml: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-bio.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To allow Jetty to be started from xinetd -->
<!-- mixin jetty-xinetd.xml: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-xinetd.xml -->
<!-- -->
<!-- See jetty-xinetd.xml for further instructions. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="WebappContexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
<Item>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<Call name="addLifeCycle">
<Arg>
<New id="ContextDeployer" class="org.eclipse.jetty.deploy.ContextDeployer">
<Set name="contexts"><Ref id="WebappContexts" /></Set>
<Set name="configurationDir">
<Property name="test.resourcesdir" default="src/test/resources" />/contexts
</Set>
<Set name="scanInterval">0</Set>
<Set name="configurationManager">
<New class="org.eclipse.jetty.deploy.FileConfigurationManager">
<Set name="file">
<Property name="test.targetdir" default="target" />/xml-configured-jetty.properties
</Set>
</New>
</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure the context deployer -->
<!-- A context deployer will deploy contexts described in -->
<!-- configuration files discovered in a directory. -->
<!-- The configuration directory can be scanned for hot -->
<!-- deployments at the configured scanInterval. -->
<!-- -->
<!-- This deployer is configured to deploy contexts configured -->
<!-- in the $JETTY_HOME/contexts directory -->
<!-- -->
<!-- =========================================================== -->
<!--
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.deploy.ContextDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
<Set name="scanInterval">5</Set>
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
</Call>
</New>
</Arg>
</Call>
-->
<!-- =========================================================== -->
<!-- Configure the webapp deployer. -->
<!-- A webapp deployer will deploy standard webapps discovered -->
<!-- in a directory at startup, without the need for additional -->
<!-- configuration files. It does not support hot deploy or -->
<!-- non standard contexts (see ContextDeployer above). -->
<!-- -->
<!-- This deployer is configured to deploy webapps from the -->
<!-- $JETTY_HOME/webapps directory -->
<!-- -->
<!-- Normally only one type of deployer need be used. -->
<!-- -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.deploy.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir"><SystemProperty name="test.resourcesdir" default="src/test/resources"/>/webapps</Set>
<Set name="parentLoaderPriority">false</Set>
<Set name="extract">true</Set>
<Set name="allowDuplicates">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="test.resourcesdir" default="src/test/resources"/>/etc/webdefault.xml</Set>
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
</Call>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure Authentication Login Service -->
<!-- Realms may be configured for the entire server here, or -->
<!-- they can be configured for a specific web app in a context -->
<!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
<!-- example). -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure Request Log -->
<!-- Request logs may be configured for the entire server here, -->
<!-- or they can be configured for a specific web app in a -->
<!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
<!-- for an example). -->
<!-- =========================================================== -->
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Set name="filename"><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.request.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
<Set name="gracefulShutdown">1000</Set>
</Configure>

View File

@ -0,0 +1,4 @@
root.level=DEBUG
root.appenders=stdout
appenders.stdout.class=org.eclipse.jetty.logging.impl.ConsoleAppender

View File

@ -0,0 +1,5 @@
root.level=DEBUG
root.appenders=testing
appender.console.class=org.eclipse.jetty.logging.impl.ConsoleAppender
appender.testing.class=org.eclipse.jetty.logging.impl.TestAppender

View File

@ -133,6 +133,7 @@
<module>jetty-servlet</module>
<module>jetty-webapp</module>
<module>jetty-webapp-verifier</module>
<module>jetty-centralized-logging</module>
<module>jetty-servlets</module>
<module>jetty-deploy</module>
<module>jetty-ajp</module>

View File

@ -30,9 +30,5 @@
</build>
<modules>
<module>test-webapp-rfc2616</module>
<module>test-webapp-logging-commons</module>
<module>test-webapp-logging-java</module>
<module>test-webapp-logging-log4j</module>
<module>test-webapp-logging-slf4j</module>
</modules>
</project>

View File

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Class-Path:

View File

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Class-Path:

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
// ========================================================================
// Copyright (c) Webtide LLC
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-webapps-parent</artifactId>
<version>7.0.1-SNAPSHOT</version>
</parent>
<artifactId>test-webapp-logging-log4j</artifactId>
<name>Jetty Tests :: WebApp :: Log4J Logging</name>
<packaging>war</packaging>
<build>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

View File

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Class-Path:

View File

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Class-Path: