Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. database log file configuration..

database log file configuration..

Scheduled Pinned Locked Moved Database
databasequestionworkspace
9 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13504037
    wrote on last edited by
    #1

    I am a PeopleSoft developer/programmer for the last 20+ years with just enough information about databases. But I am curious to know a bit more about the logging features of databases. Let me be specific. Is it possible to congigure the log file to show select statements on a particular field no matter which table/view that fiels is a part of? Second question: if someone does a select * from any of the tables that this field is a part of, can we configure the log to show the exact select sql statement? Your throughts and replies in detail hightly appreciated. Thanks.

    L J 3 Replies Last reply
    0
    • U User 13504037

      I am a PeopleSoft developer/programmer for the last 20+ years with just enough information about databases. But I am curious to know a bit more about the logging features of databases. Let me be specific. Is it possible to congigure the log file to show select statements on a particular field no matter which table/view that fiels is a part of? Second question: if someone does a select * from any of the tables that this field is a part of, can we configure the log to show the exact select sql statement? Your throughts and replies in detail hightly appreciated. Thanks.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      The answer is likely to be different for different database systems, so you most probably need to study the documentation for each one.

      U 1 Reply Last reply
      0
      • U User 13504037

        I am a PeopleSoft developer/programmer for the last 20+ years with just enough information about databases. But I am curious to know a bit more about the logging features of databases. Let me be specific. Is it possible to congigure the log file to show select statements on a particular field no matter which table/view that fiels is a part of? Second question: if someone does a select * from any of the tables that this field is a part of, can we configure the log to show the exact select sql statement? Your throughts and replies in detail hightly appreciated. Thanks.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        What you want is called "profiling" and is not used for logging but debugging. Should be easy on SQL Server. I would not use it for logging - usually a database has so many transactions that reading a logfile by yourself is not very productive. If the application is yours (and the only one accessing the db), then you can make a decorator for the IDbCommand and IDbConnection that wraps the existing commands and do the logging from there.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        U 1 Reply Last reply
        0
        • L Lost User

          What you want is called "profiling" and is not used for logging but debugging. Should be easy on SQL Server. I would not use it for logging - usually a database has so many transactions that reading a logfile by yourself is not very productive. If the application is yours (and the only one accessing the db), then you can make a decorator for the IDbCommand and IDbConnection that wraps the existing commands and do the logging from there.

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

          U Offline
          U Offline
          User 13504037
          wrote on last edited by
          #4

          Hello "I appreciate your reply from Hell programmer", (just joking about the name, but serious about the appreciation part) Thank you for your reply; as of right now totally out of my league but gave me an impression that your response is on to something I am really looking for. Your profile gives me an impresison that you are more of a technology writer, blogger rather than a hard core geek/programmer. Am I totally wrong? You mentioned MS SQL is easy to do; but how about other databases like Oracle, Db2, MySqL, etc? Do you mind sharing your personal/work email? Much appreciated, thank you.

          L 1 Reply Last reply
          0
          • L Lost User

            The answer is likely to be different for different database systems, so you most probably need to study the documentation for each one.

            U Offline
            U Offline
            User 13504037
            wrote on last edited by
            #5

            Thank you for your response. I appreciate it. I will try eventhough might be very hard for me with pretty much no experience on the DB level.

            1 Reply Last reply
            0
            • U User 13504037

              Hello "I appreciate your reply from Hell programmer", (just joking about the name, but serious about the appreciation part) Thank you for your reply; as of right now totally out of my league but gave me an impression that your response is on to something I am really looking for. Your profile gives me an impresison that you are more of a technology writer, blogger rather than a hard core geek/programmer. Am I totally wrong? You mentioned MS SQL is easy to do; but how about other databases like Oracle, Db2, MySqL, etc? Do you mind sharing your personal/work email? Much appreciated, thank you.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Member 13536030 wrote:

              Am I totally wrong?

              I don't have a blog, didn't write any book.

              Member 13536030 wrote:

              You mentioned MS SQL is easy to do; but how about other databases like Oracle, Db2, MySqL, etc?

              For MSSQL, there is a profiler-application that is part of the enterprise-version; it'll show you any SQL command that is executed against the server. In Oracle they don't call it a profiler, but a trace; each large db-vendor has their specific tools. These tools have the advantage that they show everything that is communicating with your database. If you're going to use it for debugging, then you're only interested in the SQL that your application generates. In that case there are other tools that help, like MiniProfiler: A simple but effective mini-profiler for .NET and Ruby[^]. This requires a change in code, but does not depend on a specific type of database.

              Member 13536030 wrote:

              Do you mind sharing your personal/work email?

              Yes. Any question can be asked and answered on the forum, for all to benefit. For you it has the added benefit that if I am wrong, someone will correct me :)

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

              U 1 Reply Last reply
              0
              • L Lost User

                Member 13536030 wrote:

                Am I totally wrong?

                I don't have a blog, didn't write any book.

                Member 13536030 wrote:

                You mentioned MS SQL is easy to do; but how about other databases like Oracle, Db2, MySqL, etc?

                For MSSQL, there is a profiler-application that is part of the enterprise-version; it'll show you any SQL command that is executed against the server. In Oracle they don't call it a profiler, but a trace; each large db-vendor has their specific tools. These tools have the advantage that they show everything that is communicating with your database. If you're going to use it for debugging, then you're only interested in the SQL that your application generates. In that case there are other tools that help, like MiniProfiler: A simple but effective mini-profiler for .NET and Ruby[^]. This requires a change in code, but does not depend on a specific type of database.

                Member 13536030 wrote:

                Do you mind sharing your personal/work email?

                Yes. Any question can be asked and answered on the forum, for all to benefit. For you it has the added benefit that if I am wrong, someone will correct me :)

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                U Offline
                U Offline
                User 13504037
                wrote on last edited by
                #7

                I am creating an application that will read log/profile files and parse it to find, anyalyse SQL queries (to start with only "select" statements) that are executed for a few particular fields and those tables/views that use these files. So for this application to work, the application should know the format of the file it reads. Let me see if I can be more specific: I have a field called 'field1' used by a table called 'table1'. I want to turn on / configure something in my MySQL database (it could the profiling) tool you mentioned with the goal that every night I can get a file that shows any "Select" statements against this field and table. Is that possible? Thanks.

                L 1 Reply Last reply
                0
                • U User 13504037

                  I am creating an application that will read log/profile files and parse it to find, anyalyse SQL queries (to start with only "select" statements) that are executed for a few particular fields and those tables/views that use these files. So for this application to work, the application should know the format of the file it reads. Let me see if I can be more specific: I have a field called 'field1' used by a table called 'table1'. I want to turn on / configure something in my MySQL database (it could the profiling) tool you mentioned with the goal that every night I can get a file that shows any "Select" statements against this field and table. Is that possible? Thanks.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  The mini-profiler mentioned would do that. Tracing in MySQL is discussed here[^].

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                  1 Reply Last reply
                  0
                  • U User 13504037

                    I am a PeopleSoft developer/programmer for the last 20+ years with just enough information about databases. But I am curious to know a bit more about the logging features of databases. Let me be specific. Is it possible to congigure the log file to show select statements on a particular field no matter which table/view that fiels is a part of? Second question: if someone does a select * from any of the tables that this field is a part of, can we configure the log to show the exact select sql statement? Your throughts and replies in detail hightly appreciated. Thanks.

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #9

                    Based on other responses. So database is MySQL and you want to look at what statements were used. From that you want "General query log" MySQL :: MySQL 5.7 Reference Manual :: 5.4 MySQL Server Logs[^] However be very careful if you are using this on a production machine. You want to insure that the log files do not use up the entire file system.

                    Member 13536030 wrote:

                    if someone does a select * from any of the tables

                    Just noting that is a bad idea. Shouldn't be allowed. Hinders maintenance work and things like exactly what you are doing. However you can't tell whether the client is using a specific column or not even if it was specified. But if "*" is used then you will know for a fact it is being returned.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups