174 }
175 char* key = pos;
176 char* value_str = equals_pos + 1;
177 *equals_pos = '\0';
178
179 if (strcmp(FileCountOptionKey, key) == 0) {
180 size_t value = parse_value(value_str);
181 if (value > MaxRotationFileCount) {
182 errstream->print_cr("Invalid option: %s must be in range [0, %u]",
183 FileCountOptionKey,
184 MaxRotationFileCount);
185 success = false;
186 break;
187 }
188 _file_count = static_cast<uint>(value);
189 } else if (strcmp(FileSizeOptionKey, key) == 0) {
190 julong value;
191 success = Arguments::atojulong(value_str, &value);
192 if (!success || (value > SIZE_MAX)) {
193 errstream->print_cr("Invalid option: %s must be in range [0, "
194 SIZE_FORMAT "]", FileSizeOptionKey, SIZE_MAX);
195 success = false;
196 break;
197 }
198 _rotate_size = static_cast<size_t>(value);
199 } else {
200 errstream->print_cr("Invalid option '%s' for log file output.", key);
201 success = false;
202 break;
203 }
204 pos = comma_pos + 1;
205 } while (comma_pos != NULL);
206
207 os::free(opts);
208 return success;
209 }
210
211 bool LogFileOutput::initialize(const char* options, outputStream* errstream) {
212 if (!parse_options(options, errstream)) {
213 return false;
214 }
419 file_name_pos += second_replace_len;
420 } else {
421 // Else, copy char by char of the original file
422 result[i] = file_name[file_name_pos++];
423 i++;
424 }
425 }
426 // Add terminating char
427 result[result_len] = '\0';
428 return result;
429 }
430
431 void LogFileOutput::describe(outputStream *out) {
432 LogOutput::describe(out);
433 out->print(" ");
434
435 out->print("filecount=%u,filesize=" SIZE_FORMAT "%s", _file_count,
436 byte_size_in_proper_unit(_rotate_size),
437 proper_unit_for_byte_size(_rotate_size));
438 }
439
|
174 }
175 char* key = pos;
176 char* value_str = equals_pos + 1;
177 *equals_pos = '\0';
178
179 if (strcmp(FileCountOptionKey, key) == 0) {
180 size_t value = parse_value(value_str);
181 if (value > MaxRotationFileCount) {
182 errstream->print_cr("Invalid option: %s must be in range [0, %u]",
183 FileCountOptionKey,
184 MaxRotationFileCount);
185 success = false;
186 break;
187 }
188 _file_count = static_cast<uint>(value);
189 } else if (strcmp(FileSizeOptionKey, key) == 0) {
190 julong value;
191 success = Arguments::atojulong(value_str, &value);
192 if (!success || (value > SIZE_MAX)) {
193 errstream->print_cr("Invalid option: %s must be in range [0, "
194 SIZE_FORMAT "]", FileSizeOptionKey, (size_t)SIZE_MAX);
195 success = false;
196 break;
197 }
198 _rotate_size = static_cast<size_t>(value);
199 } else {
200 errstream->print_cr("Invalid option '%s' for log file output.", key);
201 success = false;
202 break;
203 }
204 pos = comma_pos + 1;
205 } while (comma_pos != NULL);
206
207 os::free(opts);
208 return success;
209 }
210
211 bool LogFileOutput::initialize(const char* options, outputStream* errstream) {
212 if (!parse_options(options, errstream)) {
213 return false;
214 }
419 file_name_pos += second_replace_len;
420 } else {
421 // Else, copy char by char of the original file
422 result[i] = file_name[file_name_pos++];
423 i++;
424 }
425 }
426 // Add terminating char
427 result[result_len] = '\0';
428 return result;
429 }
430
431 void LogFileOutput::describe(outputStream *out) {
432 LogOutput::describe(out);
433 out->print(" ");
434
435 out->print("filecount=%u,filesize=" SIZE_FORMAT "%s", _file_count,
436 byte_size_in_proper_unit(_rotate_size),
437 proper_unit_for_byte_size(_rotate_size));
438 }
|