comparison src/share/vm/utilities/ostream.cpp @ 12257:01b268b3080a

8023134: Rename VM LogFile to hotspot_pid{pid}.log (was hotspot.log) Reviewed-by: twisti, kvn, sla
author vlivanov
date Fri, 13 Sep 2013 04:16:54 -0700
parents dbc0b5dc08f5
children da051ce490eb
comparison
equal deleted inserted replaced
12256:591b49112612 12257:01b268b3080a
590 return buf; 590 return buf;
591 } 591 }
592 592
593 void defaultStream::init_log() { 593 void defaultStream::init_log() {
594 // %%% Need a MutexLocker? 594 // %%% Need a MutexLocker?
595 const char* log_name = LogFile != NULL ? LogFile : "hotspot.log"; 595 const char* log_name = LogFile != NULL ? LogFile : "hotspot_pid%p.log";
596 const char* try_name = make_log_name(log_name, NULL); 596 const char* try_name = make_log_name(log_name, NULL);
597 fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); 597 fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
598 if (!file->is_open()) { 598 if (!file->is_open()) {
599 // Try again to open the file. 599 // Try again to open the file.
600 char warnbuf[O_BUFLEN*2]; 600 char warnbuf[O_BUFLEN*2];
601 jio_snprintf(warnbuf, sizeof(warnbuf), 601 jio_snprintf(warnbuf, sizeof(warnbuf),
602 "Warning: Cannot open log file: %s\n", try_name); 602 "Warning: Cannot open log file: %s\n", try_name);
603 // Note: This feature is for maintainer use only. No need for L10N. 603 // Note: This feature is for maintainer use only. No need for L10N.
604 jio_print(warnbuf); 604 jio_print(warnbuf);
605 FREE_C_HEAP_ARRAY(char, try_name, mtInternal); 605 FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
606 try_name = make_log_name("hs_pid%p.log", os::get_temp_directory()); 606 try_name = make_log_name(log_name, os::get_temp_directory());
607 jio_snprintf(warnbuf, sizeof(warnbuf), 607 jio_snprintf(warnbuf, sizeof(warnbuf),
608 "Warning: Forcing option -XX:LogFile=%s\n", try_name); 608 "Warning: Forcing option -XX:LogFile=%s\n", try_name);
609 jio_print(warnbuf); 609 jio_print(warnbuf);
610 delete file; 610 delete file;
611 file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); 611 file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
612 FREE_C_HEAP_ARRAY(char, try_name, mtInternal); 612 }
613 } 613 FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
614
614 if (file->is_open()) { 615 if (file->is_open()) {
615 _log_file = file; 616 _log_file = file;
616 xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file); 617 xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
617 _outer_xmlStream = xs; 618 _outer_xmlStream = xs;
618 if (this == tty) xtty = xs; 619 if (this == tty) xtty = xs;