java.lang.System.Logger.Level Java Examples
The following examples show how to use
java.lang.System.Logger.Level.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModelMBeanAttributeInfo.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Constructs a new ModelMBeanAttributeInfo object from this * ModelMBeanAttributeInfo Object. A default descriptor will * be created. * * @param inInfo the ModelMBeanAttributeInfo to be duplicated */ public ModelMBeanAttributeInfo(ModelMBeanAttributeInfo inInfo) { super(inInfo.getName(), inInfo.getType(), inInfo.getDescription(), inInfo.isReadable(), inInfo.isWritable(), inInfo.isIs()); if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanAttributeInfo(ModelMBeanAttributeInfo) " + "Entry"); } Descriptor newDesc = inInfo.getDescriptor(); attrDescriptor = validDescriptor(newDesc); }
Example #2
Source File: BootstrapLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private LogEvent(BootstrapLogger bootstrap, PlatformLogger.Level platformLevel, String sourceClass, String sourceMethod, ResourceBundle bundle, String msg, Throwable thrown, Object[] params) { this.acc = AccessController.getContext(); this.timeMillis = System.currentTimeMillis(); this.nanoAdjustment = VM.getNanoTimeAdjustment(timeMillis); this.level = null; this.platformLevel = platformLevel; this.bundle = bundle; this.msg = msg; this.msgSupplier = null; this.thrown = thrown; this.params = params; this.sourceClass = sourceClass; this.sourceMethod = sourceMethod; this.bootstrap = bootstrap; }
Example #3
Source File: RelationService.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Retrieves role info for given role name of a given relation type. * * @param relationTypeName name of relation type * @param roleInfoName name of role * * @return RoleInfo object. * * @exception IllegalArgumentException if null parameter * @exception RelationTypeNotFoundException if the relation type is not * known in the Relation Service * @exception RoleInfoNotFoundException if the role is not part of the * relation type. */ public RoleInfo getRoleInfo(String relationTypeName, String roleInfoName) throws IllegalArgumentException, RelationTypeNotFoundException, RoleInfoNotFoundException { if (relationTypeName == null || roleInfoName == null) { String excMsg = "Invalid parameter."; throw new IllegalArgumentException(excMsg); } RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", relationTypeName, roleInfoName); // Can throw a RelationTypeNotFoundException RelationType relType = getRelationType(relationTypeName); // Can throw a RoleInfoNotFoundException RoleInfo roleInfo = relType.getRoleInfo(roleInfoName); RELATION_LOGGER.log(Level.TRACE, "RETURN"); return roleInfo; }
Example #4
Source File: BootstrapLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private LogEvent(BootstrapLogger bootstrap, Level level, ResourceBundle bundle, String msg, Throwable thrown, Object[] params) { this.acc = AccessController.getContext(); this.timeMillis = System.currentTimeMillis(); this.nanoAdjustment = VM.getNanoTimeAdjustment(timeMillis); this.level = level; this.platformLevel = null; this.bundle = bundle; this.msg = msg; this.msgSupplier = null; this.thrown = thrown; this.params = params; this.sourceClass = null; this.sourceMethod = null; this.bootstrap = bootstrap; }
Example #5
Source File: RelationSupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Returns all roles present in the relation. * * @return a RoleResult object, including a RoleList (for roles * successfully retrieved) and a RoleUnresolvedList (for roles not * readable). * * @exception RelationServiceNotRegisteredException if the Relation * Service is not registered in the MBean Server */ public RoleResult getAllRoles() throws RelationServiceNotRegisteredException { RELATION_LOGGER.log(Level.TRACE, "ENTRY"); RoleResult result = null; try { result = getAllRolesInt(false, null); } catch (IllegalArgumentException exc) { // OK : Invalid parameters, ignore... } RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; }
Example #6
Source File: RelationSupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Retrieves role value for given role name. * <P>Checks if the role exists and is readable according to the relation * type. * * @param roleName name of role * * @return the ArrayList of ObjectName objects being the role value * * @exception IllegalArgumentException if null role name * @exception RoleNotFoundException if: * <P>- there is no role with given name * <P>- the role is not readable. * @exception RelationServiceNotRegisteredException if the Relation * Service is not registered in the MBean Server * * @see #setRole */ public List<ObjectName> getRole(String roleName) throws IllegalArgumentException, RoleNotFoundException, RelationServiceNotRegisteredException { if (roleName == null) { String excMsg = "Invalid parameter."; throw new IllegalArgumentException(excMsg); } RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleName); // Can throw RoleNotFoundException and // RelationServiceNotRegisteredException List<ObjectName> result = cast( getRoleInt(roleName, false, null, false)); RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; }
Example #7
Source File: CustomLoggerTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static LogEvent of(boolean isLoggable, String name, Level level, ResourceBundle bundle, String key, Throwable thrown) { LogEvent evt = new LogEvent(); evt.isLoggable = isLoggable; evt.loggerName = name; evt.level = level; evt.args = null; evt.bundle = bundle; evt.thrown = thrown; evt.supplier = null; evt.msg = key; return evt; }
Example #8
Source File: ServerImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
ServerImpl ( HttpServer wrapper, String protocol, InetSocketAddress addr, int backlog ) throws IOException { this.protocol = protocol; this.wrapper = wrapper; this.logger = System.getLogger ("com.sun.net.httpserver"); ServerConfig.checkLegacyProperties (logger); https = protocol.equalsIgnoreCase ("https"); this.address = addr; contexts = new ContextList(); schan = ServerSocketChannel.open(); if (addr != null) { ServerSocket socket = schan.socket(); socket.bind (addr, backlog); bound = true; } selector = Selector.open (); schan.configureBlocking (false); listenerKey = schan.register (selector, SelectionKey.OP_ACCEPT); dispatcher = new Dispatcher(); idleConnections = Collections.synchronizedSet (new HashSet<HttpConnection>()); allConnections = Collections.synchronizedSet (new HashSet<HttpConnection>()); reqConnections = Collections.synchronizedSet (new HashSet<HttpConnection>()); rspConnections = Collections.synchronizedSet (new HashSet<HttpConnection>()); time = System.currentTimeMillis(); timer = new Timer ("server-timer", true); timer.schedule (new ServerTimerTask(), CLOCK_TICK, CLOCK_TICK); if (timer1Enabled) { timer1 = new Timer ("server-timer1", true); timer1.schedule (new ServerTimerTask1(),TIMER_MILLIS,TIMER_MILLIS); logger.log (Level.DEBUG, "HttpServer timer1 enabled period in ms: ", TIMER_MILLIS); logger.log (Level.DEBUG, "MAX_REQ_TIME: "+MAX_REQ_TIME); logger.log (Level.DEBUG, "MAX_RSP_TIME: "+MAX_RSP_TIME); } events = new LinkedList<Event>(); logger.log (Level.DEBUG, "HttpServer created "+protocol+" "+ addr); }
Example #9
Source File: RelationSupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Callback used by the Relation Service when a MBean referenced in a role * is unregistered. * <P>The Relation Service will call this method to let the relation * take action to reflect the impact of such unregistration. * <P>BEWARE. the user is not expected to call this method. * <P>Current implementation is to set the role with its current value * (list of ObjectNames of referenced MBeans) without the unregistered * one. * * @param objectName ObjectName of unregistered MBean * @param roleName name of role where the MBean is referenced * * @exception IllegalArgumentException if null parameter * @exception RoleNotFoundException if role does not exist in the * relation or is not writable * @exception InvalidRoleValueException if role value does not conform to * the associated role info (this will never happen when called from the * Relation Service) * @exception RelationServiceNotRegisteredException if the Relation * Service is not registered in the MBean Server * @exception RelationTypeNotFoundException if the relation type has not * been declared in the Relation Service. * @exception RelationNotFoundException if this method is called for a * relation MBean not added in the Relation Service. */ public void handleMBeanUnregistration(ObjectName objectName, String roleName) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException { if (objectName == null || roleName == null) { String excMsg = "Invalid parameter."; throw new IllegalArgumentException(excMsg); } RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", objectName, roleName); // Can throw RoleNotFoundException, InvalidRoleValueException, // or RelationTypeNotFoundException handleMBeanUnregistrationInt(objectName, roleName, false, null); RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; }
Example #10
Source File: ModelMBeanInfoSupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns the ModelMBeanConstructorInfo requested by name. * If no ModelMBeanConstructorInfo exists for this name null is returned. * * @param inName the name of the constructor. * * @return the constructor info for the named constructor, or null * if there is none. * * @exception MBeanException Wraps a distributed communication Exception. * @exception RuntimeOperationsException Wraps an IllegalArgumentException * for a null constructor name. */ public ModelMBeanConstructorInfo getConstructor(String inName) throws MBeanException, RuntimeOperationsException { ModelMBeanConstructorInfo retInfo = null; if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (inName == null) { throw new RuntimeOperationsException( new IllegalArgumentException("Constructor name is null"), "Exception occurred trying to get the " + "ModelMBeanConstructorInfo of the MBean"); } MBeanConstructorInfo[] consList = modelMBeanConstructors; //this.getConstructors(); int numCons = 0; if (consList != null) numCons = consList.length; for (int i=0; (i < numCons) && (retInfo == null); i++) { if (inName.equals(consList[i].getName())) { retInfo = ((ModelMBeanConstructorInfo) consList[i].clone()); } } if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return retInfo; }
Example #11
Source File: PlatformLoggerBridgeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg) { log(LogEvent.of(isLoggable(level), name, sourceClass, sourceMethod, level, null, msg, null, (Object[])null)); }
Example #12
Source File: DescriptorSupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Descriptor default constructor. * Default initial descriptor size is 20. It will grow as needed.<br> * Note that the created empty descriptor is not a valid descriptor * (the method {@link #isValid isValid} returns <CODE>false</CODE>) */ public DescriptorSupport() { if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "Constructor"); } init(null); }
Example #13
Source File: Repository.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void unregistering(RegistrationContext context, ObjectName name) { if (context == null) return; try { context.unregistered(); } catch (Exception x) { // shouldn't come here... MBEANSERVER_LOGGER.log(Level.DEBUG, "Unexpected exception while unregistering "+name, x); } }
Example #14
Source File: PlatformLoggerBridgeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass, String sourceMethod, Throwable thrown, Supplier<String> msgSupplier) { log(LogEvent.of(isLoggable(level), name, sourceClass, sourceMethod, level, null, msgSupplier, thrown, (Object[])null)); }
Example #15
Source File: DescriptorSupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns a human readable string representing the * descriptor. The string will be in the format of * "fieldName=fieldValue,fieldName2=fieldValue2,..."<br> * * If there are no fields in the descriptor, then an empty String * is returned.<br> * * If a fieldValue is an object then the toString() method is * called on it and its returned value is used as the value for * the field enclosed in parenthesis. * * @exception RuntimeOperationsException for illegal value for * field Names or field Values. If the descriptor string fails * for any reason, this exception will be thrown. */ @Override public synchronized String toString() { if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } String respStr = ""; String[] fields = getFields(); if ((fields == null) || (fields.length == 0)) { if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "Empty Descriptor"); } return respStr; } if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "Printing " + fields.length + " fields"); } for (int i=0; i < fields.length; i++) { if (i == (fields.length - 1)) { respStr = respStr.concat(fields[i]); } else { respStr = respStr.concat(fields[i] + ", "); } } if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "Exit returning " + respStr); } return respStr; }
Example #16
Source File: MLet.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Converts the String value of the constructor's parameter to * a basic Java object with the type of the parameter. */ private Object constructParameter(String param, String type) { // check if it is a primitive type Class<?> c = primitiveClasses.get(type); if (c != null) { try { Constructor<?> cons = c.getConstructor(String.class); Object[] oo = new Object[1]; oo[0]=param; return(cons.newInstance(oo)); } catch (Exception e) { MLET_LOGGER.log(Level.DEBUG, "Got unexpected exception", e); } } if (type.compareTo("java.lang.Boolean") == 0) return Boolean.valueOf(param); if (type.compareTo("java.lang.Byte") == 0) return Byte.valueOf(param); if (type.compareTo("java.lang.Short") == 0) return Short.valueOf(param); if (type.compareTo("java.lang.Long") == 0) return Long.valueOf(param); if (type.compareTo("java.lang.Integer") == 0) return Integer.valueOf(param); if (type.compareTo("java.lang.Float") == 0) return Float.valueOf(param); if (type.compareTo("java.lang.Double") == 0) return Double.valueOf(param); if (type.compareTo("java.lang.String") == 0) return param; return param; }
Example #17
Source File: AbstractLoggerWrapper.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void logrb(PlatformLogger.Level level, ResourceBundle bundle, String msg, Throwable thrown) { final PlatformLogger.Bridge platformProxy = platformProxy(); if (platformProxy == null) { wrapped().log(level.systemLevel(), bundle, msg, thrown); } else { platformProxy.logrb(level, bundle, msg, thrown); } }
Example #18
Source File: DefaultMBeanServerInterceptor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException { NotificationListener instance = getListener(listener); if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name + ", Listener = " + listener); } server.removeNotificationListener(name, instance); }
Example #19
Source File: ServerImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public synchronized void removeContext (String path) throws IllegalArgumentException { if (path == null) { throw new NullPointerException ("null path parameter"); } contexts.remove (protocol, path); logger.log (Level.DEBUG, "context removed: " + path); }
Example #20
Source File: BootstrapLogger.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public void log(Level level, ResourceBundle bundle, String key, Throwable thrown) { if (checkBootstrapping()) { push(LogEvent.valueOf(this, level, bundle, key, thrown)); } else { final Logger spi = holder.wrapped(); spi.log(level, bundle, key, thrown); } }
Example #21
Source File: BootstrapLogger.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public void log(Level level, ResourceBundle bundle, String format, Object... params) { if (checkBootstrapping()) { push(LogEvent.valueOf(this, level, bundle, format, params)); } else { final Logger spi = holder.wrapped(); spi.log(level, bundle, format, params); } }
Example #22
Source File: PlatformLoggerBridgeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg, Throwable thrown) { log(LogEvent.of(isLoggable(level), name, sourceClass, sourceMethod, level, null, msg, thrown, (Object[])null)); }
Example #23
Source File: LoggerBridgeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass, String sourceMethod, Supplier<String> msgSupplier) { log(LogEvent.of(isLoggable(level), name, sourceClass, sourceMethod, level, null, msgSupplier, null, (Object[])null)); }
Example #24
Source File: TimerAlarmClock.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * This method is called by the timer when it is started. */ public void run() { try { //this.sleep(timeout); TimerAlarmClockNotification notif = new TimerAlarmClockNotification(this); listener.notifyAlarmClock(notif); } catch (Exception e) { TIMER_LOGGER.log(Level.TRACE, "Got unexpected exception when sending a notification", e); } }
Example #25
Source File: BaseLoggerBridgeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static LogEvent of(boolean isLoggable, String name, Level level, ResourceBundle bundle, String key, Throwable thrown) { LogEvent evt = new LogEvent(); evt.isLoggable = isLoggable; evt.loggerName = name; evt.level = level; evt.args = null; evt.bundle = bundle; evt.thrown = thrown; evt.supplier = null; evt.msg = key; return evt; }
Example #26
Source File: ModelMBeanInfoSupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public ModelMBeanAttributeInfo getAttribute(String inName) throws MBeanException, RuntimeOperationsException { ModelMBeanAttributeInfo retInfo = null; if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (inName == null) { throw new RuntimeOperationsException( new IllegalArgumentException("Attribute Name is null"), "Exception occurred trying to get the " + "ModelMBeanAttributeInfo of the MBean"); } MBeanAttributeInfo[] attrList = modelMBeanAttributes; int numAttrs = 0; if (attrList != null) numAttrs = attrList.length; for (int i=0; (i < numAttrs) && (retInfo == null); i++) { if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { final StringBuilder strb = new StringBuilder() .append("\t\n this.getAttributes() MBeanAttributeInfo Array ") .append(i).append(":") .append(((ModelMBeanAttributeInfo)attrList[i]).getDescriptor()) .append("\t\n this.modelMBeanAttributes MBeanAttributeInfo Array ") .append(i).append(":") .append(((ModelMBeanAttributeInfo)modelMBeanAttributes[i]).getDescriptor()); MODELMBEAN_LOGGER.log(Level.TRACE, strb::toString); } if (inName.equals(attrList[i].getName())) { retInfo = ((ModelMBeanAttributeInfo)attrList[i].clone()); } } if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return retInfo; }
Example #27
Source File: BootstrapLogger.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public void log(PlatformLogger.Level level, Supplier<String> msgSupplier) { if (checkBootstrapping()) { push(LogEvent.valueOf(this, level, msgSupplier)); } else { final PlatformLogger.Bridge spi = holder.platform(); spi.log(level, msgSupplier); } }
Example #28
Source File: BaseDefaultLoggerFinderTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void log(Level level, String string, Object... os) { try { invoke(System.Logger.class.getMethod( "log", Level.class, String.class, Object[].class), level, string, os); } catch (NoSuchMethodException ex) { throw new RuntimeException(ex); } }
Example #29
Source File: BootstrapLogger.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg) { if (checkBootstrapping()) { push(LogEvent.valueOf(this, level, sourceClass, sourceMethod, null, msg, (Object[])null)); } else { final PlatformLogger.Bridge spi = holder.platform(); spi.logp(level, sourceClass, sourceMethod, msg); } }
Example #30
Source File: BootstrapLogger.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, Supplier<String> msgSupplier) { if (checkBootstrapping()) { push(LogEvent.valueOf(this, level, sourceClass, sourceMethod, msgSupplier, null)); } else { final PlatformLogger.Bridge spi = holder.platform(); spi.logp(level, sourceClass, sourceMethod, msgSupplier); } }