Hmm, I understand but don't like it. It's overcomplicated.

What about a different approach:
1, let's ALWAYS return SanitizingLogWrapper
2, let's add _LOG_SANITIZING_ENABLED in SanitizingLogWrapper constructor
3, let's call SanitizingLogWrapper.setLogSanitizingEnabled() once props are initialized

    public static Log getLog(String name) {

        // The following concurrent collection retrieve has the side effect of a
        // memory fence read. This will invalidate all dirty cache data if there
        // are any. If the LogWrapper swap happens before this, the new Log will
        // be visible to the current Thread.

        LogWrapper logWrapper = _logWrappers.get(name);

        if (logWrapper == null) {
            logWrapper = new SanitizingLogWrapper(
				_logFactory.getLog(name), _LOG_SANITIZING_ENABLED);

            LogWrapper previousLogWrapper = _logWrappers.putIfAbsent(
                name, logWrapper);

            if (previousLogWrapper != null) {
                logWrapper = previousLogWrapper;
            }
        }

        return logWrapper;
    }

	public static void setLogFactory(LogFactory logFactory) {
		PortalRuntimePermission.checkSetBeanProperty(LogFactoryUtil.class);

		for (Map.Entry<String, LogWrapper> entry : _logWrappers.entrySet()) {
			String name = entry.getKey();

			SecureLogWrapper secureLogWrapper = 
				(SecureLogWrapper) entry.getValue();

			secureLogWrapper.setLogSanitizingEnabled(_LOG_SANITIZING_ENABLED);

			secureLogWrapper.setLog(logFactory.getLog(name));
		}

		// The following volatile write will flush out all cache data. All
		// previously swapped LogWrappers will be visible for any reads after a
		// memory fence read according to the happens-before rules.

		_logFactory = logFactory;
	}

SanitizingLogWrapper then decide on the boolean, what do you think?