<?xml version="1.0"?>

<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<!-- =============================================================== -->
<!-- Configure stderr and stdout to also go to a rollover log file   -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">

  <New id="ServerLog" class="java.io.PrintStream">
    <Arg>
      <!-- Split output to both the file and the old stderr -->
      <New class="org.apache.commons.io.output.TeeOutputStream">
        <Arg>
          <New class="org.eclipse.jetty.util.RolloverFileOutputStream">
            <Arg><Property name="xwiki.data.dir" default="."/>/logs/yyyy_mm_dd.output.log</Arg>
            <Arg type="boolean">false</Arg>
            <Arg type="int">90</Arg>
            <Arg><Call class="java.util.TimeZone" name="getTimeZone"><Arg>GMT</Arg></Call></Arg>
            <Get id="ServerLogName" name="datedFilename"/>
          </New>
        </Arg>
        <Arg><Get class="java.lang.System" name="err"/></Arg>
      </New>
    </Arg>
  </New>

  <Call class="java.lang.System" name="setErr"><Arg><Ref id="ServerLog"/></Arg></Call>
  <Call class="java.lang.System" name="setOut"><Arg><Ref id="ServerLog"/></Arg></Call>

</Configure>
