本文整理汇总了Java中com.intellij.openapi.application.PathManager.getLogPath方法的典型用法代码示例。如果您正苦于以下问题:Java PathManager.getLogPath方法的具体用法?Java PathManager.getLogPath怎么用?Java PathManager.getLogPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.application.PathManager
的用法示例。
在下文中一共展示了PathManager.getLogPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyUser
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
public static void notifyUser(String message) {
final String logFile = PathManager.getLogPath();
/*String createIssuePart = "<br>" +
"<br>" +
"Please attach log files from <a href=\"file\">" + logFile + "</a><br>" +
"to the <a href=\"url\">YouTrack issue</a>";*/
Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID,
"Local History is broken",
message /*+ createIssuePart*/,
NotificationType.ERROR,
new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification,
@NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if ("url".equals(event.getDescription())) {
BrowserUtil.browse("http://youtrack.jetbrains.net/issue/IDEA-71270");
}
else {
File file = new File(logFile);
ShowFilePathAction.openFile(file);
}
}
}
}), null);
}
示例2: deleteOldThreadDumps
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
private static void deleteOldThreadDumps() {
File allLogsDir = new File(PathManager.getLogPath());
if (allLogsDir.isDirectory()) {
final String[] dirs = allLogsDir.list(new FilenameFilter() {
@Override
public boolean accept(@NotNull final File dir, @NotNull final String name) {
return name.startsWith("threadDumps-");
}
});
if (dirs != null) {
Arrays.sort(dirs);
for (int i = 0; i < dirs.length - 11; i++) {
FileUtil.delete(new File(allLogsDir, dirs [i]));
}
}
}
}
示例3: init
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
private void init() {
try {
System.setProperty("log4j.defaultInitOverride", "true");
File logXmlFile = FileUtil.findFirstThatExist(PathManager.getHomePath() + "/bin/log.xml",
PathManager.getHomePath() + "/community/bin/log.xml");
if (logXmlFile == null) {
throw new RuntimeException("log.xml file does not exist! Path: [ $home/bin/log.xml]");
}
String text = FileUtil.loadFile(logXmlFile);
text = StringUtil.replace(text, SYSTEM_MACRO, StringUtil.replace(PathManager.getSystemPath(), "\\", "\\\\"));
text = StringUtil.replace(text, APPLICATION_MACRO, StringUtil.replace(PathManager.getHomePath(), "\\", "\\\\"));
text = StringUtil.replace(text, LOG_DIR_MACRO, StringUtil.replace(PathManager.getLogPath(), "\\", "\\\\"));
File file = new File(PathManager.getLogPath());
if (!file.mkdirs() && !file.exists()) {
System.err.println("Cannot create log directory: " + file);
}
new DOMConfigurator().doConfigure(new StringReader(text), LogManager.getLoggerRepository());
myInitialized = true;
}
catch (Exception e) {
e.printStackTrace();
}
}
示例4: initLogOutput
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
private void initLogOutput() {
if (CvsApplicationLevelConfiguration.getInstance().DO_OUTPUT) {
final File cvsOutputFile = new File(PathManager.getLogPath(), OUTPUT_FILE_NAME);
if (cvsOutputFile.isFile() && cvsOutputFile.length() > MAX_OUTPUT_SIZE) {
FileUtil.delete(cvsOutputFile);
}
myLogOutput = createFileOutputStream(cvsOutputFile);
} else {
myLogOutput = DUMMY_OUTPUT_STREAM;
}
}
示例5: lookup
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@Override
public String lookup(String key) {
return PathManager.getLogPath();
}
示例6: logTest
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@Test
public void logTest(){
//Jasypt encryptor to generate encrypted information
/*
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
encryptor.setPassword("jasypt");
String usr = encryptor.encrypt("INSERT");
System.out.println(usr);
String pw = encryptor.encrypt("INSERT");
System.out.println(pw);
String ip = encryptor.encrypt("INSERT");
System.out.println(ip);
*/
//Checks if file exists and has content
System.out.println(PathManager.getLogPath());
logger.info("\"" + "Test" + "\"" + ":" + "\"" + "Hello World!" + "\"" + "}");
File file = new File(PathManager.getLogPath() + "/logfile.log");
try{
Scanner scanner = new Scanner(file);
List<String> list=new ArrayList<>();
while(scanner.hasNextLine()){
list.add(scanner.nextLine());
}
if(list.isEmpty()){
assertTrue(false);
}else{
assertTrue(true);
}
}catch (Exception e){
e.printStackTrace();
}
}
示例7: getBuildLogDirectory
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
public File getBuildLogDirectory() {
return new File(PathManager.getLogPath(), "build-log");
}
示例8: getPtyLogFile
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
private static File getPtyLogFile() {
return new File(PathManager.getLogPath(), "pty.log");
}
示例9: actionPerformed
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final File logFile = new File(PathManager.getLogPath(), "idea.log");
ShowFilePathAction.openFile(logFile);
}
示例10: execute
import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@Override
protected void execute(@NotNull Project project) {
File logFile = new File(PathManager.getLogPath(), IDEA_LOG_FILE_NAME);
ShowFilePathAction.openFile(logFile);
}