<?xml version="1.0" encoding="UTF-8"?>

<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<!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>
