790 return _log_file != NULL; |
790 return _log_file != NULL; |
791 } |
791 } |
792 |
792 |
793 void defaultStream::init_log() { |
793 void defaultStream::init_log() { |
794 // %%% Need a MutexLocker? |
794 // %%% Need a MutexLocker? |
795 const char* log_name = LogFile != NULL ? LogFile : "hotspot.log"; |
795 const char* log_name = LogFile != NULL ? LogFile : "hotspot_pid%p.log"; |
796 const char* try_name = make_log_name(log_name, NULL); |
796 const char* try_name = make_log_name(log_name, NULL); |
797 fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); |
797 fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); |
798 if (!file->is_open()) { |
798 if (!file->is_open()) { |
799 // Try again to open the file. |
799 // Try again to open the file. |
800 char warnbuf[O_BUFLEN*2]; |
800 char warnbuf[O_BUFLEN*2]; |
801 jio_snprintf(warnbuf, sizeof(warnbuf), |
801 jio_snprintf(warnbuf, sizeof(warnbuf), |
802 "Warning: Cannot open log file: %s\n", try_name); |
802 "Warning: Cannot open log file: %s\n", try_name); |
803 // Note: This feature is for maintainer use only. No need for L10N. |
803 // Note: This feature is for maintainer use only. No need for L10N. |
804 jio_print(warnbuf); |
804 jio_print(warnbuf); |
805 FREE_C_HEAP_ARRAY(char, try_name, mtInternal); |
805 FREE_C_HEAP_ARRAY(char, try_name, mtInternal); |
806 try_name = make_log_name("hs_pid%p.log", os::get_temp_directory()); |
806 try_name = make_log_name(log_name, os::get_temp_directory()); |
807 jio_snprintf(warnbuf, sizeof(warnbuf), |
807 jio_snprintf(warnbuf, sizeof(warnbuf), |
808 "Warning: Forcing option -XX:LogFile=%s\n", try_name); |
808 "Warning: Forcing option -XX:LogFile=%s\n", try_name); |
809 jio_print(warnbuf); |
809 jio_print(warnbuf); |
810 delete file; |
810 delete file; |
811 file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); |
811 file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); |
812 FREE_C_HEAP_ARRAY(char, try_name, mtInternal); |
812 } |
813 } |
813 FREE_C_HEAP_ARRAY(char, try_name, mtInternal); |
|
814 |
814 if (file->is_open()) { |
815 if (file->is_open()) { |
815 _log_file = file; |
816 _log_file = file; |
816 xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file); |
817 xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file); |
817 _outer_xmlStream = xs; |
818 _outer_xmlStream = xs; |
818 if (this == tty) xtty = xs; |
819 if (this == tty) xtty = xs; |