fix(logging): retain the user values for error_log when toggling the log on/off
parent
b8960c3443
commit
476a9bcfdf
|
@ -24,6 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { errorLogPathDisabled } from '../../util/logging';
|
||||
import sslProfiles from '../../util/ssl_profiles';
|
||||
import websiteConf from './website.conf';
|
||||
|
||||
|
@ -112,7 +113,7 @@ export default (domains, global) => {
|
|||
config.http.push(['error_log', global.logging.errorLogPath.computed.trim() +
|
||||
` ${global.logging.errorLogLevel.computed}`]);
|
||||
} else {
|
||||
config.http.push(['error_log', '/dev/null']);
|
||||
config.http.push(['error_log', errorLogPathDisabled]);
|
||||
}
|
||||
|
||||
if (global.security.limitReq.computed) {
|
||||
|
|
|
@ -154,7 +154,7 @@ THE SOFTWARE.
|
|||
<script>
|
||||
import delegatedFromDefaults from '../../util/delegated_from_defaults';
|
||||
import computedFromDefaults from '../../util/computed_from_defaults';
|
||||
import { accessLogPathDefault, accessLogParamsDefault, errorLogPathDefault, errorLogLevelDefault, errorLogLevelOptions, errorLogLevelDisabled } from '../../util/logging';
|
||||
import { accessLogPathDefault, accessLogParamsDefault, errorLogPathDefault, errorLogPathDisabled, errorLogLevelDefault, errorLogLevelOptions, errorLogLevelDisabled } from '../../util/logging';
|
||||
import PrettyCheck from '../inputs/checkbox';
|
||||
import PrettyRadio from '../inputs/radio';
|
||||
|
||||
|
@ -213,10 +213,10 @@ THE SOFTWARE.
|
|||
// disable `error_log` path selection if log level is set to `none`
|
||||
if (data.computed === errorLogLevelDisabled) {
|
||||
this.$props.data.errorLogPath.enabled = false;
|
||||
this.$props.data.errorLogPath.value = '/dev/null';
|
||||
this.$props.data.errorLogPath.computed = errorLogPathDisabled;
|
||||
} else if (!this.$props.data.errorLogPath.enabled) {
|
||||
this.$props.data.errorLogPath.enabled = true;
|
||||
this.$props.data.errorLogPath.value = this.$props.data.errorLogPath.default;
|
||||
this.$props.data.errorLogPath.computed = this.$props.data.errorLogPath.value;
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
|
|
|
@ -28,6 +28,7 @@ export const accessLogPathDefault = '/var/log/nginx/access.log';
|
|||
export const accessLogParamsDefault = 'buffer=512k flush=1m';
|
||||
|
||||
export const errorLogPathDefault = '/var/log/nginx/error.log';
|
||||
export const errorLogPathDisabled = '/dev/null';
|
||||
export const errorLogLevelDefault = 'warn';
|
||||
export const errorLogLevelOptions = Object.freeze(['debug', 'info', 'notice', 'warn', 'error', 'crit', 'alert', 'emerg']);
|
||||
export const errorLogLevelDisabled = 'none';
|
||||
|
|
|
@ -26,7 +26,7 @@ THE SOFTWARE.
|
|||
|
||||
import isObject from './is_object';
|
||||
import deepMerge from './deep_merge';
|
||||
import { accessLogPathDefault, accessLogParamsDefault, errorLogPathDefault, errorLogLevelDefault } from './logging';
|
||||
import { accessLogPathDefault, accessLogParamsDefault, errorLogPathDefault, errorLogPathDisabled, errorLogLevelDefault } from './logging';
|
||||
import { serverDomainDefault } from './defaults';
|
||||
|
||||
// Migrate old logging settings to new ones
|
||||
|
@ -45,7 +45,7 @@ const migrateLogging = data => {
|
|||
const [globalErrorLogPath, ...globalErrorLogLevel] = (globalLogging.errorLog || `${errorLogPathDefault} ${errorLogLevelDefault}`).split(' ');
|
||||
const globalErrorLogEnabled =
|
||||
!('errorLog' in globalLogging) || // errorLog was enabled by default and might not appear at all
|
||||
(globalErrorLogPath !== '' && globalErrorLogPath !== '/dev/null'); // *or* someone turned it off explicitly
|
||||
(globalErrorLogPath !== '' && globalErrorLogPath !== errorLogPathDisabled); // *or* someone turned it off explicitly
|
||||
|
||||
// set global access_log / error_log files for every domain UNLESS it was explicitly
|
||||
// enabled for the domain
|
||||
|
|
Loading…
Reference in New Issue