Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure commons-logging to log using java.util.logging #7346

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion platform/o.apache.commons.logging/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,31 @@
-->
<project name="platform/o.apache.commons.logging" default="build" basedir=".">
<import file="../../nbbuild/templates/projectized.xml"/>
<target name="jar" depends="-define-FileCRC32Calculator">
<!--
The NetBeans module org.apache.commons.logging is just a repackaging
of the original bundle, the bulk of the module is a verbatim copy of
the original commons-logging.
-->
<target name="jar" depends="-prepare-mandatory-files-for-module,projectized-common.jar,-define-FileCRC32Calculator">
<FileCRC32Calculator file="external/commons-logging-1.3.1.jar" property="o.apache.commons.logging.crc32" />
<jar jarfile="${cluster}/${module.jar}">
<zipfileset src="external/commons-logging-1.3.1.jar"/>
<!--
The module source code consists only of a bundle activator, that
configures commons-logging to log using java.util.logging. The
built classes must be included in the rebuild jar.
-->
<fileset dir="build/classes"
includes="**/*"
excludes="META-INF/LICENSE META-INF/NOTICE"
>
</fileset>
<manifest>
<attribute name="Bundle-SymbolicName" value="org.apache.commons.logging"/>
<attribute name="Bundle-Version" value="1.3.1"/>
<!-- register the BundleActivator, so that commons-logging is propertly configured -->
<attribute name="Bundle-Activator" value="org.netbeans.modules.commonslogging.CommonsLoggingBundleActivator"/>
<attribute name="Import-Package" value="org.osgi.framework"/>
<attribute name="Export-Package" value="org.apache.commons.logging;version=&quot;1.3.1&quot;,org.apache.commons.logging.impl;version=&quot;1.3.1&quot;"/>
<attribute name="NB-Original-CRC" value="${o.apache.commons.logging.crc32}"/>
</manifest>
Expand Down
4 changes: 4 additions & 0 deletions platform/o.apache.commons.logging/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<runtime-relative-path>org-apache-commons-logging.jar</runtime-relative-path>
<binary-origin>external/commons-logging-1.3.1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path></runtime-relative-path>
<binary-origin>../libs.osgi/external/osgi.core-8.0.0.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.commonslogging;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;


public class CommonsLoggingBundleActivator implements BundleActivator {

@Override
public void start(BundleContext bc) throws Exception {
// Configure commons-logging to log using java.util.logging unless
// overridden by the user
if((! System.getProperties().containsKey("org.apache.commons.logging.Log"))
&& (! System.getProperties().containsKey("org.apache.commons.logging.LogFactory"))) {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");
System.setProperty("org.apache.commons.logging.LogFactory", "org.apache.commons.logging.impl.LogFactoryImpl");
}
}

@Override
public void stop(BundleContext bc) throws Exception {
}

}
Loading