< prev index next >

src/share/vm/logging/logFileOutput.hpp

Print this page




  41   static const char*  TimestampFormat;
  42   static const size_t StartTimeBufferSize = 20;
  43   static const size_t PidBufferSize       = 21;
  44   static char         _pid_str[PidBufferSize];
  45   static char         _vm_start_time_str[StartTimeBufferSize];
  46 
  47   Mutex _rotation_lock;
  48   const char* _name;
  49   char* _file_name;
  50   char* _archive_name;
  51 
  52   uint  _current_file;
  53   uint  _file_count;
  54   uint  _file_count_max_digits;
  55 
  56   size_t  _archive_name_len;
  57   size_t  _rotate_size;
  58   size_t  _current_size;
  59 
  60   void archive();
  61   void rotate();
  62   bool configure_rotation(const char* options);
  63   char *make_file_name(const char* file_name, const char* pid_string, const char* timestamp_string);
  64   static size_t parse_value(const char* value_str);
  65 
  66   bool should_rotate() const {
  67     return _file_count > 0 && _rotate_size > 0 && _current_size >= _rotate_size;

  68   }
  69 
  70  public:
  71   LogFileOutput(const char *name);
  72   virtual ~LogFileOutput();
  73   virtual bool initialize(const char* options);
  74   virtual int write(const LogDecorations& decorations, const char* msg);








  75 
  76   virtual const char* name() const {
  77     return _name;
  78   }
  79 
  80   static void set_file_name_parameters(jlong start_time);
  81 };
  82 
  83 #endif // SHARE_VM_LOGGING_LOGFILEOUTPUT_HPP


  41   static const char*  TimestampFormat;
  42   static const size_t StartTimeBufferSize = 20;
  43   static const size_t PidBufferSize       = 21;
  44   static char         _pid_str[PidBufferSize];
  45   static char         _vm_start_time_str[StartTimeBufferSize];
  46 
  47   Mutex _rotation_lock;
  48   const char* _name;
  49   char* _file_name;
  50   char* _archive_name;
  51 
  52   uint  _current_file;
  53   uint  _file_count;
  54   uint  _file_count_max_digits;
  55 
  56   size_t  _archive_name_len;
  57   size_t  _rotate_size;
  58   size_t  _current_size;
  59 
  60   void archive();

  61   bool configure_rotation(const char* options);
  62   char *make_file_name(const char* file_name, const char* pid_string, const char* timestamp_string);
  63   static size_t parse_value(const char* value_str);
  64 
  65   bool should_rotate(bool force) {
  66     return is_rotatable() &&
  67              (force || (_rotate_size > 0 && _current_size >= _rotate_size));
  68   }
  69 
  70  public:
  71   LogFileOutput(const char *name);
  72   virtual ~LogFileOutput();
  73   virtual bool initialize(const char* options);
  74   virtual int write(const LogDecorations& decorations, const char* msg);
  75 
  76   virtual bool is_rotatable() {
  77     // Thread::current() should not be NULL because _rotation_lock needs
  78     // current thread for locking.
  79     return (Thread::current() != NULL) && (_file_count > 0);
  80   }
  81 
  82   virtual void rotate(bool force);
  83 
  84   virtual const char* name() const {
  85     return _name;
  86   }
  87 
  88   static void set_file_name_parameters(jlong start_time);
  89 };
  90 
  91 #endif // SHARE_VM_LOGGING_LOGFILEOUTPUT_HPP
< prev index next >