In my experience, Apache logging (sub)system doesn't come with big enough CPU performance penalty even on extremely busy servers to be worth looking for optimisations down that path, so your optimisation efforts could probably be more rewarding, if you consider other possible bottlenecks, such as I/O and network lag.
First, make sure that the
Off in your
httpd-vhosts.conf) file. This setting, when
On, adds a significant enough lag when resolving DNS names that it may pay off to switch it off on busy servers. If you need to resolve DNS names for statistical and tracking purposes, then I recommend using hardware based DNS resolvers (router, switch, firewall) that have DNS caching capability and can mostly do this asynchronously, then link to these logs when analyzing traffic data.
Second, analyze your server's I/O performance and check that frequent writes (IIRC Apache doesn't really read anything from these log files, it just appends to them as a file stream) don't take a significant percentage of your total I/O operations that your server can handle. On spindles (HDD), this can be costly, so you could consider spreading these logs to multiple physical drives instead of writing them all to a single drive. Obviously, if you're using HDDs, switching to SSDs is highly recommended, as they are capable of much higher IOPS. Also check suggestions for this question on Server Fault.
You could also check that you're only logging requests that you really need to. Often, requests to some file types aren't even needed or can be moved to other, simpler logs that don't consume system's resources so much (i.e. don't require DNS resolver, if you need this data logged for other requests). Both of this can be set in your Apache configuration file and might save you a microsecond or two on each request (which can accumulate).
Other suggestions could be load-balancing, moving some of the most frequently accessed files to another location and creating your own CDN, and so on, but these already fall way out of the scope of your question about Apache logfile performance.