mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 12:53:43 +01:00 
			
		
		
		
	Add config option to enable or disable log executed SQL (#3726)
* add config option to enable or disable log executed SQL * rename ShowSQL to LogSQL
This commit is contained in:
		
							parent
							
								
									45d1fc03cb
								
							
						
					
					
						commit
						d877bf7e15
					
				@ -210,6 +210,8 @@ PATH = data/gitea.db
 | 
				
			|||||||
SQLITE_TIMEOUT = 500
 | 
					SQLITE_TIMEOUT = 500
 | 
				
			||||||
; For iterate buffer, default is 50
 | 
					; For iterate buffer, default is 50
 | 
				
			||||||
ITERATE_BUFFER_SIZE = 50
 | 
					ITERATE_BUFFER_SIZE = 50
 | 
				
			||||||
 | 
					; Show the database generated SQL
 | 
				
			||||||
 | 
					LOG_SQL = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[indexer]
 | 
					[indexer]
 | 
				
			||||||
ISSUE_INDEXER_PATH = indexers/issues.bleve
 | 
					ISSUE_INDEXER_PATH = indexers/issues.bleve
 | 
				
			||||||
 | 
				
			|||||||
@ -121,6 +121,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
 | 
				
			|||||||
- `PASSWD`: **\<empty\>**: Database user password. Use \`your password\` for quoting if you use special characters in the password.
 | 
					- `PASSWD`: **\<empty\>**: Database user password. Use \`your password\` for quoting if you use special characters in the password.
 | 
				
			||||||
- `SSL_MODE`: **disable**: For PostgreSQL only.
 | 
					- `SSL_MODE`: **disable**: For PostgreSQL only.
 | 
				
			||||||
- `PATH`: **data/gitea.db**: For SQLite3 only, the database file path.
 | 
					- `PATH`: **data/gitea.db**: For SQLite3 only, the database file path.
 | 
				
			||||||
 | 
					- `LOG_SQL`: **true**: Log the executed SQL.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Indexer (`indexer`)
 | 
					## Indexer (`indexer`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -80,6 +80,7 @@ menu:
 | 
				
			|||||||
- `PASSWD`: 数据库用户密码。
 | 
					- `PASSWD`: 数据库用户密码。
 | 
				
			||||||
- `SSL_MODE`: PostgreSQL数据库是否启用SSL模式。
 | 
					- `SSL_MODE`: PostgreSQL数据库是否启用SSL模式。
 | 
				
			||||||
- `PATH`: Tidb 或者 SQLite3 数据文件存放路径。
 | 
					- `PATH`: Tidb 或者 SQLite3 数据文件存放路径。
 | 
				
			||||||
 | 
					- `LOG_SQL`: **true**: 显示生成的SQL,默认为真。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Security (`security`)
 | 
					## Security (`security`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -270,7 +270,7 @@ func SetEngine() (err error) {
 | 
				
			|||||||
	// WARNING: for serv command, MUST remove the output to os.stdout,
 | 
						// WARNING: for serv command, MUST remove the output to os.stdout,
 | 
				
			||||||
	// so use log file to instead print to stdout.
 | 
						// so use log file to instead print to stdout.
 | 
				
			||||||
	x.SetLogger(log.XORMLogger)
 | 
						x.SetLogger(log.XORMLogger)
 | 
				
			||||||
	x.ShowSQL(true)
 | 
						x.ShowSQL(setting.LogSQL)
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -159,6 +159,7 @@ var (
 | 
				
			|||||||
	UseMSSQL      bool
 | 
						UseMSSQL      bool
 | 
				
			||||||
	UsePostgreSQL bool
 | 
						UsePostgreSQL bool
 | 
				
			||||||
	UseTiDB       bool
 | 
						UseTiDB       bool
 | 
				
			||||||
 | 
						LogSQL        bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Indexer settings
 | 
						// Indexer settings
 | 
				
			||||||
	Indexer struct {
 | 
						Indexer struct {
 | 
				
			||||||
@ -931,6 +932,7 @@ func NewContext() {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	IterateBufferSize = Cfg.Section("database").Key("ITERATE_BUFFER_SIZE").MustInt(50)
 | 
						IterateBufferSize = Cfg.Section("database").Key("ITERATE_BUFFER_SIZE").MustInt(50)
 | 
				
			||||||
 | 
						LogSQL = Cfg.Section("database").Key("LOG_SQL").MustBool(true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sec = Cfg.Section("attachment")
 | 
						sec = Cfg.Section("attachment")
 | 
				
			||||||
	AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments"))
 | 
						AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments"))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user