LogRecord setResourceBundleName - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for LogRecord setResourceBundleName method.

This code example shows how to use the following methods:setMessage, setResourceBundle, setResourceBundleName
 
	public void testLocalizedFormat() { 
		// if bundle set, should use localized message 
		ResourceBundle rb = ResourceBundle
				.getBundle("bundles/java/util/logging/res");
		lr.setResourceBundle(rb);
		lr.setMessage("msg");
		String localeMsg = rb.getString("msg");
		String str = sf.format(lr);
		assertTrue(str.indexOf(localeMsg) > 0);
 
		// if bundle not set but bundle name set, should use original message 
		lr.setResourceBundle(null);
		lr.setResourceBundleName("bundles/java/util/logging/res");
		lr.setMessage("msg");
		str = sf.format(lr);
		localeMsg = rb.getString("msg");
		assertTrue(str.indexOf(localeMsg) < 0);
	} 
 
6
CodeRank
This code example shows how to use the following methods:setMessage, setParameters, setResourceBundle, setResourceBundleName
		assertNull(f.formatMessage(r));
	} 
 
	public void testLocalizedFormatMessage() { 
		// normal case 
		r.setMessage("msg");
		ResourceBundle rb = ResourceBundle
				.getBundle("bundles/java/util/logging/res");
		r.setResourceBundle(rb);
		assertEquals(rb.getString("msg"), f.formatMessage(r));
 
		// local message is a pattern 
		r.setMessage("pattern");
		Object[] oa = new Object[] { new Integer(3) };
		r.setParameters(oa);
		assertEquals(MessageFormat.format(rb.getString("pattern"), oa), f
				.formatMessage(r));
 
		// key is a pattern, but local message is not 
		r.setMessage("pattern{0,number}");

6
CodeRank
This code example shows how to use the following methods:setLoggerName, setResourceBundle, setResourceBundleName, setSourceClassName, setSourceMethodName
        } 
    } 
 
    public void logp(Level level, String sourceClass, String sourceMethod, String msg) {
        if (isLoggable(level)) {
            LogRecord lr = new LogRecord(level, msg);
            lr.setSourceClassName(sourceClass);
            lr.setSourceMethodName(sourceMethod);
            doLog(lr);
        } 
    } 
 
    public void logp(Level level, String sourceClass, String sourceMethod, String msg, Object param1) {
        if (isLoggable(level)) {
            LogRecord lr = new LogRecord(level, msg);
            lr.setSourceClassName(sourceClass);
            lr.setSourceMethodName(sourceMethod);
            Object params[] = {param1 }; 
            lr.setParameters(params);
            doLog(lr);

6
CodeRank
This code example shows how to use the following methods:setLoggerName, setResourceBundle, setResourceBundleName, setSourceClassName, setSourceMethodName
5
CodeRank
This code example shows how to use the following methods:setLoggerName, setResourceBundle, setResourceBundleName, setSourceClassName, setSourceMethodName
        } 
    } 
 
    public void logp(final Level level, final String sourceClass, final String sourceMethod, final String msg) {
        if (isLoggable(level)) {
            final LogRecord lr = new LogRecord(level, msg);
            lr.setSourceClassName(sourceClass);
            lr.setSourceMethodName(sourceMethod);
            doLog(lr);
        } 
    } 
 
    public void logp(final Level level, final String sourceClass, final String sourceMethod, final String msg, final Object param1) {
        if (isLoggable(level)) {
            final LogRecord lr = new LogRecord(level, msg);
            lr.setSourceClassName(sourceClass);
            lr.setSourceMethodName(sourceMethod);
            final Object[] params = {param1}; 
            lr.setParameters(params);
            doLog(lr);

5
CodeRank
This code example shows how to use the following methods:setLoggerName, setResourceBundle, setResourceBundleName, setSourceClassName, setSourceMethodName
 
    public void logp( Level level, String sourceClass, String sourceMethod, String msg )
    { 
        if ( isLoggable( level ) )
        { 
            LogRecord lr = new LogRecord( level, msg );
            lr.setSourceClassName( sourceClass );
            lr.setSourceMethodName( sourceMethod );
            doLog( lr );
        } 
    } 
 
    public void logp( Level level, String sourceClass, String sourceMethod, String msg, Object param1 )
    { 
        if ( isLoggable( level ) )
        { 
            LogRecord lr = new LogRecord( level, msg );
            lr.setSourceClassName( sourceClass );
            lr.setSourceMethodName( sourceMethod );
            Object params[] = { param1 }; 

5
CodeRank
This code example shows how to use the following methods:setLoggerName, setMillis, setParameters, setResourceBundle, setResourceBundleName
		assertTrue(result.indexOf("<message>bad key</message>") > 0);
		assertTrue(result.indexOf("<key>") < 0);
	} 
 
	public void testFullFormat() { 
		lr.setSourceClassName("source class");
		lr.setSourceMethodName("source method");
		lr.setLoggerName("logger name");
		lr.setMillis(0);
		lr.setThrown(new Throwable("message"));
		lr.setParameters(new Object[] { "100", "200" });
		lr.setSequenceNumber(1);
		ResourceBundle rb = ResourceBundle
				.getBundle("bundles/java/util/logging/res");
		lr.setResourceBundle(rb);
		lr.setResourceBundleName("rbname");
		String output = formatter.format(lr);
		// System.out.println(output); 
		assertTrue(output.indexOf("<record>") >= 0);
		assertTrue(output.indexOf("<date>") >= 0);
		assertTrue(output.indexOf("<millis>0</millis>") >= 0);
5
CodeRank
This code example shows how to use the following methods:setLoggerName, setResourceBundle, setResourceBundleName
        log(lr);
    } 
 
    private void doLog(LogRecord lr) 
    { 
        lr.setLoggerName(_log.getName());
        String ebname = _log.getResourceBundleName();
        if (ebname != null)
        { 
            lr.setResourceBundleName(ebname);
            lr.setResourceBundle(_log.getResourceBundle());
        } 
        _log.log(lr);
    } 
 
    public void severe(Throwable t)
    { 
        severe(null, t);
    } 
 
4
CodeRank
setResourceBundleName Method Overview
Set the localization resource bundle name.
See Code Examples for other Java 8 LogRecord Methods: