Skip to content

Commit

Permalink
PAYARA-2379 Reduced some messages that display on startup to FINE fro… (
Browse files Browse the repository at this point in the history
#2301)

* PAYARA-2379 Reduced some messages that display on startup to FINE from INFO.

Many of the startup messages not affected by the change come from Hazelcast and so cannot be changed
from Payara's codebase.

* Updated copyright

* PAYARA-2379 Fix for mistake in merge
  • Loading branch information
Cousjava authored and arjantijms committed Jan 19, 2018
1 parent 4327a88 commit 1b1741c
Show file tree
Hide file tree
Showing 19 changed files with 231 additions and 138 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
/*
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) 2016 Payara Foundation. All rights reserved.
The contents of this file are subject to the terms of the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016-2018 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://github.com/payara/Payara/blob/master/LICENSE.txt
* See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* The Payara Foundation designates this particular file as subject to the "Classpath"
* exception as provided by the Payara Foundation in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package fish.payara.ha.hazelcast.store;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
/*
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) 2016 Payara Foundation. All rights reserved.
The contents of this file are subject to the terms of the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016-2018 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://github.com/payara/Payara/blob/master/LICENSE.txt
* See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* The Payara Foundation designates this particular file as subject to the "Classpath"
* exception as provided by the Payara Foundation in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package fish.payara.ha.hazelcast.store;

Expand All @@ -36,6 +58,7 @@ and Distribution License("CDDL") (collectively, the "License"). You
/**
*
* @author steve
* @since 4.1.151
*/
@Service(name = "hazelcast")
@RunLevel(StartupRunLevel.VAL)
Expand Down Expand Up @@ -68,7 +91,7 @@ public BackingStoreTransaction createBackingStoreTransaction() {
@Override
public void postConstruct() {
BackingStoreFactoryRegistry.register("hazelcast", this);
Logger.getLogger(HazelcastBackingStoreFactory.class.getName()).log(Level.INFO, "Registered Hazelcast BackingStoreFactory with persistence-type = hazelcast");
Logger.getLogger(HazelcastBackingStoreFactory.class.getName()).log(Level.FINE, "Registered Hazelcast BackingStoreFactory with persistence-type = hazelcast");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/

// Portions Copyright [2018] Payara Foundation and/or affiliates

package com.sun.enterprise.glassfish.bootstrap.osgi;

Expand Down Expand Up @@ -84,14 +84,14 @@ public void stop() throws GlassFishException {

private void registerService() {
reg = getBundleContext().registerService(GlassFish.class.getName(), this, null);
logger.log(Level.INFO, LogFacade.SERVICE_REGISTERED, new Object[]{this, reg});
logger.log(Level.FINE, LogFacade.SERVICE_REGISTERED, new Object[]{this, reg});
}

private void unregisterService() {
if (getBundleContext() != null) { // bundle is still active
try {
reg.unregister();
logger.log(Level.INFO, LogFacade.SERVICE_UNREGISTERED, this);
logger.log(Level.FINE, LogFacade.SERVICE_UNREGISTERED, this);
} catch (IllegalStateException e) {
LogFacade.log(logger, Level.WARNING, LogFacade.SERVICE_UNREGISTRATION_EXCEPTION, e, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,18 @@ public class GFFileHandler extends StreamHandler implements
private String gffileHandlerFormatter = "";
private String currentgffileHandlerFormatter = "";

// Initially the LogRotation will be off until the domain.xml value is read.
/** Initially the LogRotation will be off until the domain.xml value is read. */
private int limitForFileRotation = 0;

private BlockingQueue<LogRecord> pendingRecords = new ArrayBlockingQueue<LogRecord>(5000);

// Rotation can be done in 3 ways
// 1. Based on the Size: Rotate when some Threshold number of bytes are
// written to server.log
// 2. Based on the Time: Rotate ever 'n' minutes, mostly 24 hrs
// 3. Rotate now
// For mechanisms 2 and 3 we will use this flag. The rotate() will always
// be fired from the publish( ) method for consistency
/**Rotation can be done in 3 ways: <ol>
* <li> Based on the Size: Rotate when some Threshold number of bytes are
* written to server.log </li>
* <li> Based on the Time: Rotate ever 'n' minutes, mostly 24 hrs </li>
* <li> Rotate now </li></ol>
* For mechanisms 2 and 3 we will use this flag. The rotate() will always
* be fired from the publish( ) method for consistency */
private AtomicBoolean rotationRequested = new AtomicBoolean(false);

protected Object rotationLock = new Object();
Expand Down Expand Up @@ -191,6 +191,7 @@ public class GFFileHandler extends StreamHandler implements

protected String logFileProperty = "";

@Override
public void postConstruct() {

LogManager manager = LogManager.getLogManager();
Expand Down Expand Up @@ -300,6 +301,7 @@ public void postConstruct() {
rotationTimeLimitValue = nextsystime - systime;

Task rotationTask = new Task() {
@Override
public Object run() {
rotate();
return null;
Expand Down Expand Up @@ -330,6 +332,7 @@ public Object run() {
if (rotationTimeLimitValue > 0) {

Task rotationTask = new Task() {
@Override
public Object run() {
rotate();
return null;
Expand Down Expand Up @@ -454,7 +457,7 @@ public Object run() {
}

formatterName = this.getFormatter().getClass().getName();
lr = new LogRecord(Level.INFO, LogFacade.LOG_FORMATTER_INFO);
lr = new LogRecord(Level.FINE, LogFacade.LOG_FORMATTER_INFO);
lr .setParameters(new Object[] {formatterName});
lr.setResourceBundle(ResourceBundle.getBundle(LogFacade.LOGGING_RB_NAME));
lr.setThreadID((int) Thread.currentThread().getId());
Expand Down Expand Up @@ -562,6 +565,7 @@ private void configureUniformLogFormatter(String excludeFields, boolean multiLin

void initializePump() {
pump = new Thread() {
@Override
public void run() {
while (!done.isSignalled()) {
try {
Expand All @@ -578,6 +582,7 @@ public void run() {
pump.start();
}

@Override
public void preDestroy() {
// stop the Queue consummer thread.
if (LogFacade.LOGGING_LOGGER.isLoggable(Level.FINE)) {
Expand Down Expand Up @@ -637,6 +642,7 @@ void changeFileName(File file) {
* A simple getter to access the current log file written by
* this FileHandler.
*/
@Override
public File getCurrentLogFile() {
return absoluteFile;
}
Expand All @@ -663,11 +669,11 @@ private void configureJSONFormatter(String excludeFields, boolean multiLineMode)
formatterClass.setLogEventBroadcaster(this);
}

// NOTE: This private class is copied from java.util.logging.FileHandler
// A metered stream is a subclass of OutputStream that
// (a) forwards all its output to a target stream
// (b) keeps track of how many bytes have been written

/** NOTE: This private class is copied from java.util.logging.FileHandler
* A metered stream is a subclass of OutputStream that
* (a) forwards all its output to a target stream
* (b) keeps track of how many bytes have been written
*/
private static final class MeteredStream extends OutputStream {

private volatile boolean isOpen = false;
Expand All @@ -681,25 +687,30 @@ private static final class MeteredStream extends OutputStream {
isOpen = true;
}

@Override
public void write(int b) throws IOException {
out.write(b);
written++;
}

@Override
public void write(byte buff[]) throws IOException {
out.write(buff);
written += buff.length;
}

@Override
public void write(byte buff[], int off, int len) throws IOException {
out.write(buff, off, len);
written += len;
}

@Override
public void flush() throws IOException {
out.flush();
}

@Override
public void close() throws IOException {
if (isOpen) {
isOpen = false;
Expand Down Expand Up @@ -788,6 +799,7 @@ public void rotate() {
final GFFileHandler thisInstance = this;
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@Override
public Object run() {
synchronized (thisInstance.rotationLock) {
if (thisInstance.meter != null
Expand Down Expand Up @@ -912,6 +924,7 @@ record = pendingRecords.take();
/**
* Publishes the logrecord storing it in our queue
*/
@Override
public void publish(LogRecord record) {

// the queue has shutdown, we are not processing any more records
Expand Down Expand Up @@ -978,6 +991,7 @@ public boolean removeLogEventListener(LogEventListener listener) {
}


@Override
public void informLogEventListeners(LogEvent logEvent) {
for (LogEventListener listener : logEventListeners) {
listener.messageLogged(logEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016] [Payara Foundation]
// Portions Copyright [2016-2018] [Payara Foundation and/or affiliates]
package com.sun.enterprise.server.logging;

import java.util.logging.Logger;
Expand Down Expand Up @@ -104,7 +104,7 @@ public class LogFacade {
@LogMessageInfo(message = "Running Payara Version: {0}", level="INFO")
public static final String GF_VERSION_INFO = "NCLS-LOGGING-00009";

@LogMessageInfo(message = "Server log file is using Formatter class: {0}", level="INFO")
@LogMessageInfo(message = "Server log file is using Formatter class: {0}", level="FINE")
public static final String LOG_FORMATTER_INFO = "NCLS-LOGGING-00010";

@LogMessageInfo(message = "Failed to parse the date: {0}", level="WARNING")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* holder.
*/

// Portions Copyright [2017] [Payara Foundation]
// Portions Copyright [2017-2018] [Payara Foundation and/or affiliates]

package com.sun.enterprise.server.logging;

Expand Down Expand Up @@ -96,15 +96,12 @@ public class ODLLogFormatter extends AnsiColorFormatter implements LogEventBroad
static {
String logSource = System.getProperty(
"com.sun.aas.logging.keyvalue.logsource");
if ((logSource != null)
&& (logSource.equals("true"))) {
if ((logSource != null) && (logSource.equals("true"))) {
LOG_SOURCE_IN_KEY_VALUE = true;
}

String recordCount = System.getProperty(
"com.sun.aas.logging.keyvalue.recordnumber");
if ((recordCount != null)
&& (recordCount.equals("true"))) {
String recordCount = System.getProperty("com.sun.aas.logging.keyvalue.recordnumber");
if ((recordCount != null) && (recordCount.equals("true"))) {
RECORD_NUMBER_IN_KEY_VALUE = true;
}

Expand Down
Loading

0 comments on commit 1b1741c

Please sign in to comment.