List of usage examples for java.util.logging LogManager getLogManager
public static LogManager getLogManager()
From source file:hudson.logging.LogRecorder.java
@Restricted(NoExternalUse.class) public AutoCompletionCandidates doAutoCompleteLoggerName(@QueryParameter String value) { if (value == null) { return new AutoCompletionCandidates(); }/* w w w . j a va 2 s. c o m*/ // get names of all actual loggers known to Jenkins Set<String> candidateNames = new LinkedHashSet<>( getAutoCompletionCandidates(Collections.list(LogManager.getLogManager().getLoggerNames()))); for (String part : value.split("[ ]+")) { HashSet<String> partCandidates = new HashSet<>(); String lowercaseValue = part.toLowerCase(Locale.ENGLISH); for (String loggerName : candidateNames) { if (loggerName.toLowerCase(Locale.ENGLISH).contains(lowercaseValue)) { partCandidates.add(loggerName); } } candidateNames.retainAll(partCandidates); } AutoCompletionCandidates candidates = new AutoCompletionCandidates(); candidates.add(candidateNames.toArray(MemoryReductionUtil.EMPTY_STRING_ARRAY)); return candidates; }
From source file:org.lightjason.examples.pokemon.CConfiguration.java
/** * loads the configuration from a file//from w ww .ja v a2s .com * * @param p_input YAML configuration file * @return instance * * @throws IOException on io errors * @throws URISyntaxException on URI syntax error */ @SuppressWarnings("unchecked") public final CConfiguration load(final String p_input) throws IOException, URISyntaxException { final URL l_path = CCommon.getResourceURL(p_input); // read configuration final Map<String, Object> l_data = (Map<String, Object>) new Yaml().load(l_path.openStream()); m_configurationpath = FilenameUtils.getPath(l_path.toString()); // get initial values m_stacktrace = (boolean) l_data.getOrDefault("stacktrace", false); m_threadsleeptime = (int) l_data.getOrDefault("threadsleeptime", 0); m_simulationstep = (int) l_data.getOrDefault("steps", Integer.MAX_VALUE); if (!(boolean) l_data.getOrDefault("logging", false)) LogManager.getLogManager().reset(); m_windowweight = ((Map<String, Integer>) l_data.getOrDefault("window", Collections.<String, Integer>emptyMap())).getOrDefault("weight", 800); m_windowheight = ((Map<String, Integer>) l_data.getOrDefault("window", Collections.<String, Integer>emptyMap())).getOrDefault("height", 600); m_zoomspeed = ((Map<String, Integer>) l_data.getOrDefault("window", Collections.<String, Integer>emptyMap())).getOrDefault("zoomspeed", 2) / 100f; m_zoomspeed = m_zoomspeed <= 0 ? 0.02f : m_zoomspeed; m_dragspeed = ((Map<String, Integer>) l_data.getOrDefault("window", Collections.<String, Integer>emptyMap())).getOrDefault("dragspeed", 100) / 1000f; m_dragspeed = m_dragspeed <= 0 ? 1f : m_dragspeed; m_screenshot = new ImmutableTriple<>( (String) ((Map<String, Object>) l_data.getOrDefault("screenshot", Collections.<String, Integer>emptyMap())).getOrDefault("file", ""), (String) ((Map<String, Object>) l_data.getOrDefault("screenshot", Collections.<String, Integer>emptyMap())).getOrDefault("format", ""), (Integer) ((Map<String, Object>) l_data.getOrDefault("screenshot", Collections.<String, Integer>emptyMap())).getOrDefault("step", -1)); // create static objects - static object are needed by the environment final List<IItem> l_static = new LinkedList<>(); this.createStatic((List<Map<String, Object>>) l_data.getOrDefault("element", Collections.<Map<String, Object>>emptyList()), l_static); m_staticelements = Collections.unmodifiableList(l_static); // create environment - static items must be exists m_environment = new CEnvironment( (Integer) ((Map<String, Object>) l_data.getOrDefault("environment", Collections.<String, Integer>emptyMap())).getOrDefault("rows", -1), (Integer) ((Map<String, Object>) l_data.getOrDefault("environment", Collections.<String, Integer>emptyMap())).getOrDefault("columns", -1), (Integer) ((Map<String, Object>) l_data.getOrDefault("environment", Collections.<String, Integer>emptyMap())).getOrDefault("cellsize", -1), ERoutingFactory.valueOf(((String) ((Map<String, Object>) l_data.getOrDefault("environment", Collections.<String, Integer>emptyMap())).getOrDefault("routing", "")).trim().toUpperCase()) .get(), m_staticelements); // create executable object list and check number of elements - environment must be exists final List<IAgent> l_agents = new LinkedList<>(); this.createAgent((Map<String, Object>) l_data.getOrDefault("agent", Collections.<String, Object>emptyMap()), l_agents, (boolean) l_data.getOrDefault("agentprint", true)); m_agents = Collections.unmodifiableList(l_agents); if (m_agents.size() + m_staticelements.size() > m_environment.column() * m_environment.row() / 2) throw new IllegalArgumentException(MessageFormat.format( "number of simulation elements are very large [{0}], so the environment size is too small, the environment " + "[{1}x{2}] must define a number of cells which is greater than the two-time number of elements", m_agents.size(), m_environment.row(), m_environment.column())); // create evaluation m_evaluation = new CEvaluation(m_agents.parallelStream()); // run initialization processes m_environment.initialize(); return this; }
From source file:ch.cyberduck.core.Preferences.java
/** * setting the default prefs values/*from w w w. ja va 2 s. c o m*/ */ protected void setDefaults() { defaults.put("tmp.dir", System.getProperty("java.io.tmpdir")); /** * The logging level (debug, info, warn, error) */ defaults.put("logging.config", "log4j-cocoa.xml"); defaults.put("logging", "error"); java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger(""); Handler[] handlers = rootLogger.getHandlers(); for (Handler handler : handlers) { rootLogger.removeHandler(handler); } // call only once during initialization time of your application SLF4JBridgeHandler.install(); /** * How many times the application was launched */ defaults.put("uses", "0"); /** * True if donation dialog will be displayed before quit */ defaults.put("donate.reminder", String.valueOf(-1)); defaults.put("donate.reminder.interval", String.valueOf(20)); // in days defaults.put("donate.reminder.date", String.valueOf(new Date(0).getTime())); defaults.put("defaulthandler.reminder", String.valueOf(true)); defaults.put("mail.feedback", "mailto:feedback@cyberduck.ch"); defaults.put("website.donate", "http://cyberduck.ch/donate/"); defaults.put("website.home", "http://cyberduck.ch/"); defaults.put("website.forum", "http://forum.cyberduck.ch/"); defaults.put("website.help", "http://help.cyberduck.ch/" + this.locale()); defaults.put("website.bug", "http://trac.cyberduck.ch/newticket/"); defaults.put("website.crash", "http://crash.cyberduck.ch/report"); defaults.put("rendezvous.enable", String.valueOf(true)); defaults.put("rendezvous.loopback.supress", String.valueOf(true)); defaults.put("growl.enable", String.valueOf(true)); defaults.put("growl.limit", String.valueOf(10)); defaults.put("path.symboliclink.resolve", String.valueOf(false)); /** * Normalize path names */ defaults.put("path.normalize", String.valueOf(true)); defaults.put("path.normalize.unicode", String.valueOf(false)); defaults.put("local.symboliclink.resolve", String.valueOf(false)); defaults.put("local.normalize.unicode", String.valueOf(true)); defaults.put("local.list.native", String.valueOf(true)); /** * Maximum number of directory listings to cache using a most recently used implementation */ defaults.put("browser.cache.size", String.valueOf(1000)); defaults.put("transfer.cache.size", String.valueOf(50)); defaults.put("icon.cache.size", String.valueOf(50)); /** * Caching NS* proxy instances. */ defaults.put("browser.model.cache.size", String.valueOf(200)); defaults.put("bookmark.model.cache.size", String.valueOf(100)); defaults.put("queue.model.cache.size", String.valueOf(50)); defaults.put("info.toolbar.selected", String.valueOf(0)); defaults.put("preferences.toolbar.selected", String.valueOf(0)); /** * Current default browser view is outline view (0-List view, 1-Outline view, 2-Column view) */ defaults.put("browser.view", "1"); /** * Save browser sessions when quitting and restore upon relaunch */ defaults.put("browser.serialize", String.valueOf(true)); defaults.put("browser.font.size", String.valueOf(12f)); defaults.put("browser.view.autoexpand", String.valueOf(true)); defaults.put("browser.view.autoexpand.useDelay", String.valueOf(true)); defaults.put("browser.view.autoexpand.delay", "1.0"); // in seconds defaults.put("browser.hidden.regex", "\\..*"); defaults.put("browser.openUntitled", String.valueOf(true)); defaults.put("browser.defaultBookmark", Locale.localizedString("None")); defaults.put("browser.markInaccessibleFolders", String.valueOf(true)); /** * Confirm closing the browsing connection */ defaults.put("browser.confirmDisconnect", String.valueOf(false)); defaults.put("browser.disconnect.showBookmarks", String.valueOf(false)); /** * Display only one info panel and change information according to selection in browser */ defaults.put("browser.info.isInspector", String.valueOf(true)); defaults.put("browser.columnKind", String.valueOf(false)); defaults.put("browser.columnExtension", String.valueOf(false)); defaults.put("browser.columnSize", String.valueOf(true)); defaults.put("browser.columnModification", String.valueOf(true)); defaults.put("browser.columnOwner", String.valueOf(false)); defaults.put("browser.columnGroup", String.valueOf(false)); defaults.put("browser.columnPermissions", String.valueOf(false)); defaults.put("browser.sort.column", "FILENAME"); defaults.put("browser.sort.ascending", String.valueOf(true)); defaults.put("browser.alternatingRows", String.valueOf(false)); defaults.put("browser.verticalLines", String.valueOf(false)); defaults.put("browser.horizontalLines", String.valueOf(true)); /** * Show hidden files in browser by default */ defaults.put("browser.showHidden", String.valueOf(false)); defaults.put("browser.charset.encoding", "UTF-8"); /** * Edit double clicked files instead of downloading */ defaults.put("browser.doubleclick.edit", String.valueOf(false)); /** * Rename files when return or enter key is pressed */ defaults.put("browser.enterkey.rename", String.valueOf(true)); /** * Enable inline editing in browser */ defaults.put("browser.editable", String.valueOf(true)); /** * Warn before renaming files */ defaults.put("browser.confirmMove", String.valueOf(false)); defaults.put("browser.logDrawer.isOpen", String.valueOf(false)); defaults.put("browser.logDrawer.size.height", String.valueOf(200)); /** * Filename (Short Date Format)Extension */ defaults.put("browser.duplicate.format", "{0} ({1}){2}"); /** * Use octal or decimal file sizes */ defaults.put("browser.filesize.decimal", String.valueOf(false)); defaults.put("browser.date.natural", String.valueOf(true)); defaults.put("info.toggle.permission", String.valueOf(1)); defaults.put("info.toggle.distribution", String.valueOf(0)); defaults.put("info.toggle.s3", String.valueOf(0)); defaults.put("connection.toggle.options", String.valueOf(0)); defaults.put("bookmark.toggle.options", String.valueOf(0)); defaults.put("alert.toggle.transcript", String.valueOf(0)); defaults.put("transfer.toggle.details", String.valueOf(1)); /** * Default editor */ defaults.put("editor.bundleIdentifier", "com.apple.TextEdit"); defaults.put("editor.alwaysUseDefault", String.valueOf(false)); defaults.put("editor.odb.enable", String.valueOf(false)); defaults.put("editor.tmp.directory", System.getProperty("java.io.tmpdir")); defaults.put("filetype.text.regex", ".*\\.txt|.*\\.cgi|.*\\.htm|.*\\.html|.*\\.shtml|.*\\.xml|.*\\.xsl|.*\\.php|.*\\.php3|" + ".*\\.js|.*\\.css|.*\\.asp|.*\\.java|.*\\.c|.*\\.cp|.*\\.cpp|.*\\.m|.*\\.h|.*\\.pl|.*\\.py|" + ".*\\.rb|.*\\.sh"); defaults.put("filetype.binary.regex", ".*\\.pdf|.*\\.ps|.*\\.exe|.*\\.bin|.*\\.jpeg|.*\\.jpg|.*\\.jp2|.*\\.gif|.*\\.tif|.*\\.ico|" + ".*\\.icns|.*\\.tiff|.*\\.bmp|.*\\.pict|.*\\.sgi|.*\\.tga|.*\\.png|.*\\.psd|" + ".*\\.hqx|.*\\.rar|.*\\.sea|.*\\.dmg|.*\\.zip|.*\\.sit|.*\\.tar|.*\\.gz|.*\\.tgz|.*\\.bz2|" + ".*\\.avi|.*\\.qtl|.*\\.bom|.*\\.pax|.*\\.pgp|.*\\.mpg|.*\\.mpeg|.*\\.mp3|.*\\.m4p|" + ".*\\.m4a|.*\\.mov|.*\\.avi|.*\\.qt|.*\\.ram|.*\\.aiff|.*\\.aif|.*\\.wav|.*\\.wma|" + ".*\\.doc|.*\\.iso|.*\\.xls|.*\\.ppt"); /** * Save bookmarks in ~/Library */ defaults.put("favorites.save", String.valueOf(true)); defaults.put("queue.openByDefault", String.valueOf(false)); defaults.put("queue.save", String.valueOf(true)); defaults.put("queue.removeItemWhenComplete", String.valueOf(false)); /** * The maximum number of concurrent transfers */ defaults.put("queue.maxtransfers", String.valueOf(5)); /** * Warning when number of transfers in queue exceeds limit */ defaults.put("queue.size.warn", String.valueOf(50)); /** * Open completed downloads */ defaults.put("queue.postProcessItemWhenComplete", String.valueOf(false)); /** * Bring transfer window to front */ defaults.put("queue.orderFrontOnStart", String.valueOf(true)); defaults.put("queue.orderBackOnStop", String.valueOf(false)); /** * Action when duplicate file exists */ defaults.put("queue.download.fileExists", "ask"); defaults.put("queue.upload.fileExists", "ask"); /** * When triggered manually using 'Reload' in the Transfer window */ defaults.put("queue.download.reload.fileExists", "ask"); defaults.put("queue.upload.reload.fileExists", "ask"); defaults.put("queue.upload.changePermissions", String.valueOf(true)); defaults.put("queue.upload.permissions.useDefault", String.valueOf(false)); defaults.put("queue.upload.permissions.file.default", String.valueOf(644)); defaults.put("queue.upload.permissions.folder.default", String.valueOf(755)); defaults.put("queue.upload.preserveDate", String.valueOf(false)); defaults.put("queue.upload.skip.enable", String.valueOf(true)); defaults.put("queue.upload.skip.regex.default", ".*~\\..*|\\.DS_Store|\\.svn|CVS"); defaults.put("queue.upload.skip.regex", ".*~\\..*|\\.DS_Store|\\.svn|CVS"); /** * Create temporary filename with an UUID and rename when upload is complete */ defaults.put("queue.upload.file.temporary", String.valueOf(false)); /** * Format string for temporary filename. Default to filename-uuid */ defaults.put("queue.upload.file.temporary.format", "{0}-{1}"); defaults.put("queue.upload.file.rename.format", "{0} ({1}){2}"); defaults.put("queue.download.file.rename.format", "{0} ({1}){2}"); defaults.put("queue.download.changePermissions", String.valueOf(true)); defaults.put("queue.download.permissions.useDefault", String.valueOf(false)); defaults.put("queue.download.permissions.file.default", String.valueOf(644)); defaults.put("queue.download.permissions.folder.default", String.valueOf(755)); defaults.put("queue.download.preserveDate", String.valueOf(true)); defaults.put("queue.download.skip.enable", String.valueOf(true)); defaults.put("queue.download.skip.regex.default", ".*~\\..*|\\.DS_Store|\\.svn|CVS|RCS|SCCS|\\.git|\\.bzr|\\.bzrignore|\\.bzrtags|\\.hg|\\.hgignore|\\.hgtags|_darcs"); defaults.put("queue.download.skip.regex", ".*~\\..*|\\.DS_Store|\\.svn|CVS|RCS|SCCS|\\.git|\\.bzr|\\.bzrignore|\\.bzrtags|\\.hg|\\.hgignore|\\.hgtags|_darcs"); defaults.put("queue.download.quarantine", String.valueOf(true)); defaults.put("queue.download.wherefrom", String.valueOf(true)); defaults.put("queue.sync.compare.hash", String.valueOf(true)); defaults.put("queue.sync.compare.size", String.valueOf(false)); defaults.put("queue.dock.badge", String.valueOf(false)); defaults.put("queue.sleep.prevent", String.valueOf(true)); /** * Bandwidth throttle options */ StringBuilder options = new StringBuilder(); options.append(5 * TransferStatus.KILO).append(","); options.append(10 * TransferStatus.KILO).append(","); options.append(20 * TransferStatus.KILO).append(","); options.append(50 * TransferStatus.KILO).append(","); options.append(100 * TransferStatus.KILO).append(","); options.append(150 * TransferStatus.KILO).append(","); options.append(200 * TransferStatus.KILO).append(","); options.append(500 * TransferStatus.KILO).append(","); options.append(1 * TransferStatus.MEGA).append(","); options.append(2 * TransferStatus.MEGA).append(","); options.append(5 * TransferStatus.MEGA).append(","); options.append(10 * TransferStatus.MEGA).append(","); options.append(15 * TransferStatus.MEGA).append(","); options.append(20 * TransferStatus.MEGA).append(","); options.append(50 * TransferStatus.MEGA).append(","); options.append(100 * TransferStatus.MEGA).append(","); defaults.put("queue.bandwidth.options", options.toString()); /** * Bandwidth throttle upload stream */ defaults.put("queue.upload.bandwidth.bytes", String.valueOf(-1)); /** * Bandwidth throttle download stream */ defaults.put("queue.download.bandwidth.bytes", String.valueOf(-1)); /** * While downloading, update the icon of the downloaded file as a progress indicator */ defaults.put("queue.download.icon.update", String.valueOf(true)); defaults.put("queue.download.icon.threshold", String.valueOf(TransferStatus.MEGA * 5)); /** * Default synchronize action selected in the sync dialog */ defaults.put("queue.sync.action.default", "upload"); defaults.put("queue.prompt.action.default", "overwrite"); defaults.put("queue.logDrawer.isOpen", String.valueOf(false)); defaults.put("queue.logDrawer.size.height", String.valueOf(200)); defaults.put("http.compression.enable", String.valueOf(true)); /** * HTTP routes to maximum number of connections allowed for those routes */ defaults.put("http.connections.route", String.valueOf(5)); /** * Total number of connections in the pool */ defaults.put("http.connections.total", String.valueOf(5)); defaults.put("http.manager.timeout", String.valueOf(0)); // Inifinite defaults.put("http.socket.buffer", String.valueOf(131072)); defaults.put("http.credentials.charset", "ISO-8859-1"); /** * Enable or disable verification that the remote host taking part * of a data connection is the same as the host to which the control * connection is attached. */ defaults.put("ftp.datachannel.verify", String.valueOf(false)); defaults.put("ftp.command.feat", String.valueOf(true)); defaults.put("ftp.socket.buffer", String.valueOf(131072)); /** * Send LIST -a */ defaults.put("ftp.command.lista", String.valueOf(true)); defaults.put("ftp.command.stat", String.valueOf(true)); defaults.put("ftp.command.mlsd", String.valueOf(true)); defaults.put("ftp.command.utime", String.valueOf(true)); /** * Fallback to active or passive mode respectively */ defaults.put("ftp.connectmode.fallback", String.valueOf(true)); /** * Protect the data channel by default. For TLS, the data connection * can have one of two security levels. 1) Clear (requested by 'PROT C') 2) Private (requested by 'PROT P') */ defaults.put("ftp.tls.datachannel", "P"); //C defaults.put("ftp.tls.session.requirereuse", String.valueOf(true)); defaults.put("ftp.ssl.session.cache.size", String.valueOf(100)); /** * Try to determine the timezone automatically using timestamp comparison from MLST and LIST */ defaults.put("ftp.timezone.auto", String.valueOf(false)); defaults.put("ftp.timezone.default", TimeZone.getDefault().getID()); /** * Default bucket location */ defaults.put("s3.location", "US"); defaults.put("s3.bucket.acl.default", "public-read"); //defaults.put("s3.bucket.acl.default", "private"); defaults.put("s3.key.acl.default", "public-read"); //defaults.put("s3.key.acl.default", "private"); /** * Default redundancy level */ defaults.put("s3.storage.class", "STANDARD"); //defaults.put("s3.encryption.algorithm", "AES256"); defaults.put("s3.encryption.algorithm", StringUtils.EMPTY); /** * Validaty for public S3 URLs */ defaults.put("s3.url.expire.seconds", String.valueOf(24 * 60 * 60)); //expiry time for public URL defaults.put("s3.mfa.serialnumber", StringUtils.EMPTY); defaults.put("s3.listing.chunksize", String.valueOf(1000)); /** * Show revisions as hidden files in browser */ defaults.put("s3.revisions.enable", String.valueOf(true)); /** * If set calculate MD5 sum of uploaded file and set metadata header Content-MD5 */ defaults.put("s3.upload.metadata.md5", String.valueOf(false)); defaults.put("s3.upload.multipart", String.valueOf(true)); defaults.put("s3.upload.multipart.concurency", String.valueOf(5)); /** * Threshold in bytes. Only use multipart uploads for files more than 5GB */ defaults.put("s3.upload.multipart.threshold", String.valueOf(5L * 1024L * 1024L * 1024L)); defaults.put("s3.upload.multipart.size", String.valueOf(5L * 1024L * 1024L)); /** * A prefix to apply to log file names */ defaults.put("s3.logging.prefix", "logs/"); defaults.put("google.logging.prefix", "log"); defaults.put("cloudfront.logging.prefix", "logs/"); defaults.put("google.storage.oauth.clientid", "996125414232.apps.googleusercontent.com"); defaults.put("google.storage.oauth.secret", "YdaFjo2t74-Q0sThsXgeTv3l"); final int month = 60 * 60 * 24 * 30; //30 days in seconds defaults.put("s3.cache.seconds", String.valueOf(month)); /** * Default metadata for uploads. Format must be "key1=value1 key2=value2" */ defaults.put("s3.metadata.default", StringUtils.EMPTY); defaults.put("azure.metadata.default", StringUtils.EMPTY); defaults.put("cf.authentication.context", "/v1.0"); defaults.put("cf.upload.metadata.md5", String.valueOf(false)); defaults.put("cf.metadata.default", StringUtils.EMPTY); defaults.put("cf.list.limit", String.valueOf(10000)); defaults.put("cf.list.cdn.preload", String.valueOf(true)); //doc Microsoft Word //html HTML Format //odt Open Document Format //pdf Portable Document Format //png Portable Networks Graphic Image Format //rtf Rich Format //txt TXT File //zip ZIP archive. Contains the images (if any) used in the document and an exported .html file. defaults.put("google.docs.export.document", "doc"); defaults.put("google.docs.export.document.formats", "doc,html,odt,pdf,png,rtf,txt,zip"); //pdf Portable Document Format //png Portable Networks Graphic Image Format //ppt Powerpoint Format //swf Flash Format //txt TXT file defaults.put("google.docs.export.presentation", "ppt"); defaults.put("google.docs.export.presentation.formats", "ppt,pdf,png,swf,txt"); //xls XLS (Microsoft Excel) //csv CSV (Comma Seperated Value) //pdf PDF (Portable Document Format) //ods ODS (Open Document Spreadsheet) //tsv TSV (Tab Seperated Value) //html HTML Format defaults.put("google.docs.export.spreadsheet", "xls"); defaults.put("google.docs.export.spreadsheet.formats", "xls,csv,pdf,ods,tsv,html"); defaults.put("google.docs.upload.convert", String.valueOf(true)); defaults.put("google.docs.upload.ocr", String.valueOf(false)); /** * Show revisions as hidden files in browser */ defaults.put("google.docs.revisions.enable", String.valueOf(false)); /** * If set to true will only trash documents */ defaults.put("google.docs.delete.trash", String.valueOf(false)); /** * NTLM Windows Domain */ defaults.put("webdav.ntlm.domain", StringUtils.EMPTY); defaults.put("webdav.ntlm.workstation", StringUtils.EMPTY); /** * Enable Expect-Continue handshake */ defaults.put("webdav.expect-continue", String.valueOf(true)); defaults.put("analytics.provider.qloudstat.setup", "https://qloudstat.com/configuration/add"); defaults.put("analytics.provider.qloudstat.iam.policy", "{\n" + " \"Statement\": [\n" + " {\n" + " \"Action\": [\n" + " \"s3:GetObject\", \n" + " \"s3:ListBucket\"\n" + " ], \n" + " \"Condition\": {\n" + " \"Bool\": {\n" + " \"aws:SecureTransport\": \"true\"\n" + " }\n" + " }, \n" + " \"Effect\": \"Allow\", \n" + " \"Resource\": \"arn:aws:s3:::%s/*\"\n" + " }, \n" + " {\n" + " \"Action\": [\n" + " \"s3:ListAllMyBuckets\", \n" + " \"s3:GetBucketLogging\", \n" + " \"s3:GetBucketLocation\"\n" + " ], \n" + " \"Effect\": \"Allow\", \n" + " \"Resource\": \"arn:aws:s3:::*\"\n" + " }, \n" + " {\n" + " \"Action\": [\n" + " \"cloudfront:GetDistribution\", \n" + " \"cloudfront:GetDistributionConfig\", \n" + " \"cloudfront:ListDistributions\", \n" + " \"cloudfront:GetStreamingDistribution\", \n" + " \"cloudfront:GetStreamingDistributionConfig\", \n" + " \"cloudfront:ListStreamingDistributions\"\n" + " ], \n" + " \"Condition\": {\n" + " \"Bool\": {\n" + " \"aws:SecureTransport\": \"true\"\n" + " }\n" + " }, \n" + " \"Effect\": \"Allow\", \n" + " \"Resource\": \"*\"\n" + " }\n" + " ]\n" + "}\n"); /** * Maximum concurrent connections to the same host * Unlimited by default */ defaults.put("connection.host.max", String.valueOf(-1)); /** * Default login name */ defaults.put("connection.login.name", System.getProperty("user.name")); defaults.put("connection.login.anon.name", "anonymous"); defaults.put("connection.login.anon.pass", "cyberduck@example.net"); /** * Search for passphrases in Keychain */ defaults.put("connection.login.useKeychain", String.valueOf(true)); /** * Add to Keychain option is checked in login prompt */ defaults.put("connection.login.addKeychain", String.valueOf(true)); defaults.put("connection.port.default", String.valueOf(21)); defaults.put("connection.protocol.default", Protocol.FTP.getIdentifier()); /** * Socket timeout */ defaults.put("connection.timeout.seconds", String.valueOf(30)); /** * Retry to connect after a I/O failure automatically */ defaults.put("connection.retry", String.valueOf(0)); defaults.put("connection.retry.delay", String.valueOf(10)); defaults.put("connection.hostname.default", StringUtils.EMPTY); /** * Try to resolve the hostname when entered in connection dialog */ defaults.put("connection.hostname.check", String.valueOf(true)); //Check hostname reachability using NSNetworkDiagnostics defaults.put("connection.hostname.idn", String.valueOf(true)); //Convert hostnames to Punycode /** * java.net.preferIPv6Addresses */ defaults.put("connection.dns.ipv6", String.valueOf(false)); /** * Read proxy settings from system preferences */ defaults.put("connection.proxy.enable", String.valueOf(true)); defaults.put("connection.proxy.ntlm.domain", StringUtils.EMPTY); /** * Warning when opening connections sending credentials in plaintext */ defaults.put("connection.unsecure.warning", String.valueOf(true)); defaults.put("connection.unsecure.switch", String.valueOf(true)); defaults.put("connection.ssl.protocols", "SSLv3, TLSv1"); /** * Transfer read buffer size */ defaults.put("connection.chunksize", String.valueOf(32768)); defaults.put("disk.unmount.timeout", String.valueOf(2)); defaults.put("transcript.length", String.valueOf(1000)); /** * Read favicon from Web URL */ defaults.put("bookmark.favicon.download", String.valueOf(true)); /** * Default to large icon size */ defaults.put("bookmark.icon.size", String.valueOf(64)); /** * Use the SFTP subsystem or a SCP channel for file transfers over SSH */ defaults.put("ssh.transfer", Protocol.SFTP.getIdentifier()); // Session.SCP defaults.put("ssh.authentication.publickey.default.enable", String.valueOf(false)); defaults.put("ssh.authentication.publickey.default.rsa", "~/.ssh/id_rsa"); defaults.put("ssh.authentication.publickey.default.dsa", "~/.ssh/id_dsa"); defaults.put("archive.default", "tar.gz"); /** * Archiver */ defaults.put("archive.command.create.tar", "tar -cpPf {0}.tar {1}"); defaults.put("archive.command.create.tar.gz", "tar -czpPf {0}.tar.gz {1}"); defaults.put("archive.command.create.tar.bz2", "tar -cjpPf {0}.tar.bz2 {1}"); defaults.put("archive.command.create.zip", "zip -qr {0}.zip {1}"); defaults.put("archive.command.create.gz", "gzip -qr {1}"); defaults.put("archive.command.create.bz2", "bzip2 -zk {1}"); /** * Unarchiver */ defaults.put("archive.command.expand.tar", "tar -xpPf {0} -C {1}"); defaults.put("archive.command.expand.tar.gz", "tar -xzpPf {0} -C {1}"); defaults.put("archive.command.expand.tar.bz2", "tar -xjpPf {0} -C {1}"); defaults.put("archive.command.expand.zip", "unzip -qn {0} -d {1}"); defaults.put("archive.command.expand.gz", "gzip -d {0}"); defaults.put("archive.command.expand.bz2", "bzip2 -dk {0}"); defaults.put("update.check", String.valueOf(true)); final int day = 60 * 60 * 24; defaults.put("update.check.interval", String.valueOf(day)); // periodic update check in seconds defaults.put("terminal.bundle.identifier", "com.apple.Terminal"); defaults.put("terminal.command", "do script \"{0}\""); defaults.put("terminal.command.ssh", "ssh -t {0} {1}@{2} -p {3} \"cd {4} && exec \\$SHELL\""); }
From source file:es.csic.iiia.planes.cli.Cli.java
/** * Initializes the logging system.//from w w w . j av a2 s.c om */ private static void initializeLogging() { try { // Load logging configuration LogManager.getLogManager().readConfiguration(Cli.class.getResourceAsStream("/logging.properties")); } catch (IOException ex) { LOG.log(Level.SEVERE, null, ex); } catch (SecurityException ex) { LOG.log(Level.SEVERE, null, ex); } }
From source file:org.rhq.enterprise.gui.startup.Configurator.java
private void loadJavaLoggingConfiguration() { InputStream loggingPropertiesStream = Configurator.class.getClassLoader() .getResourceAsStream(LOGGING_PROPERTIES_RESOURCE); if (loggingPropertiesStream != null) { try {// ww w .j a v a 2 s. c o m LogManager.getLogManager().readConfiguration(loggingPropertiesStream); } catch (IOException e) { log.error("Failed to load '" + LOGGING_PROPERTIES_RESOURCE + "' from webapp classloader."); } } }
From source file:alma.acs.logging.AcsLogger.java
/** * Non-standard factory method to be used only for special offline or testing purposes * where typically an AcsLogger must be provided by an alternative implementation of ContainerServices. * The returned AcsLogger is just like a JDK Logger obtained from {@link Logger#getLogger(String, String)}. * <p>//w w w . j a v a 2s . c o m * Note that we do not supply a {@link LogConfig} and therefore the new AcsLogger cannot register itself * for initial configuration or later configuration change notifications. <br> * <b>It is the client's responsibility to configure the log level and parent logger of the returned AcsLogger!</b> * * @param name the logger's name * @param resourceBundleName * @return <code>AcsLogger</code> that is as close to a normal JDK Logger as possible. * @throws IllegalArgumentException * If a Logger of the given <code>name</code> exists but is not an <code>AcsLogger</code>, * or if an AcsLogger of the given <code>name</code> exists but has a different <code>resourceBundleName</code>. */ public static AcsLogger createUnconfiguredLogger(String name, String resourceBundleName) { // the following code is copied and modified from Logger.getLogger LogManager manager = LogManager.getLogManager(); Logger jdkLogger = manager.getLogger(name); if (jdkLogger != null && !(jdkLogger instanceof AcsLogger)) { throw new IllegalArgumentException( "Logger " + name + " already exists but is not of subtype AcsLogger."); } AcsLogger result = (AcsLogger) jdkLogger; if (result == null) { // Create a new logger. // Note: we may get a MissingResourceException here. result = new AcsLogger(name, resourceBundleName, null, true, null); manager.addLogger(result); result = (AcsLogger) manager.getLogger(name); } // unlike in the JDK logger, we can't fix the resource bundle name if the logger from cache had null and now one is given. // however we check that the old and new bundle are consistent. if (result.getResourceBundleName() != null && !result.getResourceBundleName().equals(resourceBundleName)) { throw new IllegalArgumentException(result.getResourceBundleName() + " != " + resourceBundleName); } return result; }
From source file:MailHandlerDemo.java
/** * Used debug problems with the logging.properties. The system property * java.security.debug=access,stack can be used to trace access to the * LogManager reset.// www . j a v a 2 s .c o m * * @param prefix a string to prefix the output. * @param err any PrintStream or null for System.out. */ @SuppressWarnings("UseOfSystemOutOrSystemErr") private static void checkConfig(String prefix, PrintStream err) { if (prefix == null || prefix.trim().length() == 0) { prefix = "DEBUG"; } if (err == null) { err = System.out; } try { err.println(prefix + ": java.version=" + System.getProperty("java.version")); err.println(prefix + ": LOGGER=" + LOGGER.getLevel()); err.println(prefix + ": JVM id " + ManagementFactory.getRuntimeMXBean().getName()); err.println(prefix + ": java.security.debug=" + System.getProperty("java.security.debug")); SecurityManager sm = System.getSecurityManager(); if (sm != null) { err.println(prefix + ": SecurityManager.class=" + sm.getClass().getName()); err.println(prefix + ": SecurityManager classLoader=" + toString(sm.getClass().getClassLoader())); err.println(prefix + ": SecurityManager.toString=" + sm); } else { err.println(prefix + ": SecurityManager.class=null"); err.println(prefix + ": SecurityManager.toString=null"); err.println(prefix + ": SecurityManager classLoader=null"); } String policy = System.getProperty("java.security.policy"); if (policy != null) { File f = new File(policy); err.println(prefix + ": AbsolutePath=" + f.getAbsolutePath()); err.println(prefix + ": CanonicalPath=" + f.getCanonicalPath()); err.println(prefix + ": length=" + f.length()); err.println(prefix + ": canRead=" + f.canRead()); err.println(prefix + ": lastModified=" + new java.util.Date(f.lastModified())); } LogManager manager = LogManager.getLogManager(); String key = "java.util.logging.config.file"; String cfg = System.getProperty(key); if (cfg != null) { err.println(prefix + ": " + cfg); File f = new File(cfg); err.println(prefix + ": AbsolutePath=" + f.getAbsolutePath()); err.println(prefix + ": CanonicalPath=" + f.getCanonicalPath()); err.println(prefix + ": length=" + f.length()); err.println(prefix + ": canRead=" + f.canRead()); err.println(prefix + ": lastModified=" + new java.util.Date(f.lastModified())); } else { err.println(prefix + ": " + key + " is not set as a system property."); } err.println(prefix + ": LogManager.class=" + manager.getClass().getName()); err.println(prefix + ": LogManager classLoader=" + toString(manager.getClass().getClassLoader())); err.println(prefix + ": LogManager.toString=" + manager); err.println(prefix + ": MailHandler classLoader=" + toString(MailHandler.class.getClassLoader())); err.println( prefix + ": Context ClassLoader=" + toString(Thread.currentThread().getContextClassLoader())); err.println(prefix + ": Session ClassLoader=" + toString(Session.class.getClassLoader())); err.println(prefix + ": DataHandler ClassLoader=" + toString(DataHandler.class.getClassLoader())); final String p = MailHandler.class.getName(); key = p.concat(".mail.to"); String to = manager.getProperty(key); err.println(prefix + ": TO=" + to); if (to != null) { err.println(prefix + ": TO=" + Arrays.toString(InternetAddress.parse(to, true))); } key = p.concat(".mail.from"); String from = manager.getProperty(key); if (from == null || from.length() == 0) { Session session = Session.getInstance(new Properties()); InternetAddress local = InternetAddress.getLocalAddress(session); err.println(prefix + ": FROM=" + local); } else { err.println(prefix + ": FROM=" + Arrays.asList(InternetAddress.parse(from, false))); err.println(prefix + ": FROM=" + Arrays.asList(InternetAddress.parse(from, true))); } synchronized (manager) { final Enumeration<String> e = manager.getLoggerNames(); while (e.hasMoreElements()) { final Logger l = manager.getLogger(e.nextElement()); if (l != null) { final Handler[] handlers = l.getHandlers(); if (handlers.length > 0) { err.println(prefix + ": " + l.getClass().getName() + ", " + l.getName()); for (Handler h : handlers) { err.println(prefix + ":\t" + toString(prefix, err, h)); } } } } } } catch (Throwable error) { err.print(prefix + ": "); error.printStackTrace(err); } err.flush(); }
From source file:org.mocksy.server.http.MocksyServer.java
public static void configureLogger() { try {// w w w . ja va 2 s .co m // ridiculous workaround for // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6244047 new File("logs").mkdirs(); LogManager.getLogManager() .readConfiguration(MocksyServer.class.getResourceAsStream("logging.properties")); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:ryerson.daspub.Main.java
/** * Execute commands.//ww w . ja v a 2 s . c o m */ @Override public void run() { // show help message if (cmd.hasOption(CMD_HELP)) { showHelpMessage(); System.exit(SUCCESS); } // load configuration if (cmd.hasOption(CMD_CONFIG)) { try { String path = cmd.getOptionValue(CMD_CONFIG); configFile = new File(path); config = Config.load(configFile); } catch (Exception ex) { String stack = ExceptionUtils.getStackTrace(ex); logger.log(Level.SEVERE, "Could not parse configuration file\n\n{0}", stack); System.exit(FAIL); } } // show gui or process command line options if (cmd.hasOption(CMD_GUI)) { ApplicationJFrame frame = ApplicationJFrame.getInstance(); // send logging output to jtextarea JTextArea textArea = frame.getLogOutputTextArea(); JTextAreaOutputHandler handler = new JTextAreaOutputHandler(textArea); handler.setFormatter(new JTextAreaOutputFormatter()); handler.setLevel(Level.ALL); Logger rootlogger = LogManager.getLogManager().getLogger(""); rootlogger.addHandler(handler); // load project if specified at command line if (configFile != null) { try { frame.openProject(configFile); } catch (Exception ex) { String stack = ExceptionUtils.getStackTrace(ex); logger.log(Level.SEVERE, "Could not load configuration file {0}\n\n{1}", new Object[] { configFile.getAbsolutePath(), stack }); } } // display the application frame frame.setVisible(true); logger.log(Level.INFO, "Ready"); } else if (cmd.hasOption(CMD_INIT)) { executeInit(); } else if (cmd.hasOption(CMD_PUBLISH)) { executePublish(); } }
From source file:shuffle.fwk.ShuffleController.java
/** * Sets the user home to the given path. * //from w ww .jav a2s . c o m * @param userHome * The absolute path to the new user home. */ public static void setUserHome(String userHome) { try { File absoluteFile = new File(userHome).getCanonicalFile(); absoluteFile.mkdir(); System.setProperty("user.dir", absoluteFile.getCanonicalPath()); System.setProperty("user.home", absoluteFile.getCanonicalPath()); try (InputStream is = ClassLoader.getSystemResourceAsStream(LOG_CONFIG_FILE)) { File logDir = new File("log").getAbsoluteFile(); if (!logDir.exists() && !logDir.mkdirs()) { throw new IOException("Cannot create log directory."); } LogManager.getLogManager().readConfiguration(is); } catch (IOException e) { e.printStackTrace(); } } catch (SecurityException e) { e.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } }